diff --git a/CMakeLists.txt b/CMakeLists.txt
index 816685425ad5e22339c25eecc85d4d2464f68885..18a142110fb8cfc7097fb2b804194994643cb04c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1256,17 +1256,12 @@ set(ZIG_LIBC_FILES
"glibc/bits/floatn-common.h"
"glibc/bits/libc-header-start.h"
"glibc/bits/long-double.h"
- "glibc/bits/param.h"
"glibc/bits/pthreadtypes.h"
- "glibc/bits/sched.h"
"glibc/bits/select.h"
- "glibc/bits/setjmp.h"
"glibc/bits/signum-generic.h"
- "glibc/bits/signum.h"
"glibc/bits/stat.h"
"glibc/bits/stdint-intn.h"
"glibc/bits/stdlib-bsearch.h"
- "glibc/bits/time.h"
"glibc/bits/time64.h"
"glibc/bits/timesize.h"
"glibc/bits/types/__sigset_t.h"
@@ -1308,21 +1303,16 @@ set(ZIG_LIBC_FILES
"glibc/include/libc-pointer-arith.h"
"glibc/include/libc-symbols.h"
"glibc/include/pthread.h"
- "glibc/include/sched.h"
- "glibc/include/setjmp.h"
"glibc/include/signal.h"
- "glibc/include/stackinfo.h"
"glibc/include/stap-probe.h"
"glibc/include/stdc-predef.h"
"glibc/include/stdlib.h"
"glibc/include/sys/cdefs.h"
- "glibc/include/sys/param.h"
"glibc/include/sys/select.h"
"glibc/include/sys/signal.h"
"glibc/include/sys/stat.h"
- "glibc/include/sys/time.h"
"glibc/include/sys/types.h"
- "glibc/include/time.h"
+ "glibc/include/syscall.h"
"glibc/io/bits/statx.h"
"glibc/io/fstat.c"
"glibc/io/fstat64.c"
@@ -1338,15 +1328,12 @@ set(ZIG_LIBC_FILES
"glibc/locale/bits/types/__locale_t.h"
"glibc/locale/bits/types/locale_t.h"
"glibc/misc/sys/cdefs.h"
- "glibc/misc/sys/param.h"
"glibc/misc/sys/select.h"
+ "glibc/misc/syscall.h"
"glibc/nptl/pthread_atfork.c"
"glibc/posix/bits/cpu-set.h"
"glibc/posix/bits/types.h"
- "glibc/posix/sched.h"
"glibc/posix/sys/types.h"
- "glibc/setjmp/setjmp.h"
- "glibc/setjmp/setjmp.h"
"glibc/signal/bits/types/sig_atomic_t.h"
"glibc/signal/bits/types/sigset_t.h"
"glibc/signal/signal.h"
@@ -1358,45 +1345,271 @@ set(ZIG_LIBC_FILES
"glibc/stdlib/exit.h"
"glibc/stdlib/stdlib.h"
"glibc/string/endian.h"
- "glibc/sysdeps/generic/allocalim.h"
+ "glibc/sysdeps/aarch64/bits/endian.h"
+ "glibc/sysdeps/aarch64/crti.S"
+ "glibc/sysdeps/aarch64/crtn.S"
+ "glibc/sysdeps/aarch64/dl-sysdep.h"
+ "glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/aarch64/start.S"
+ "glibc/sysdeps/aarch64/sysdep.h"
+ "glibc/sysdeps/alpha/bits/endian.h"
+ "glibc/sysdeps/alpha/crti.S"
+ "glibc/sysdeps/alpha/crtn.S"
+ "glibc/sysdeps/alpha/dl-dtprocnum.h"
+ "glibc/sysdeps/alpha/dl-sysdep.h"
+ "glibc/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/alpha/start.S"
+ "glibc/sysdeps/arm/bits/endian.h"
+ "glibc/sysdeps/arm/crti.S"
+ "glibc/sysdeps/arm/crtn.S"
+ "glibc/sysdeps/arm/dl-sysdep.h"
+ "glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/arm/start.S"
+ "glibc/sysdeps/arm/sysdep.h"
+ "glibc/sysdeps/csky/abiv2/start.S"
+ "glibc/sysdeps/csky/bits/endian.h"
+ "glibc/sysdeps/csky/dl-sysdep.h"
+ "glibc/sysdeps/csky/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/csky/sysdep.h"
"glibc/sysdeps/generic/dl-dtprocnum.h"
+ "glibc/sysdeps/generic/dl-sysdep.h"
"glibc/sysdeps/generic/dwarf2.h"
"glibc/sysdeps/generic/libc-lock.h"
- "glibc/sysdeps/generic/stackinfo.h"
"glibc/sysdeps/generic/symbol-hacks.h"
+ "glibc/sysdeps/generic/sys/syscall.h"
"glibc/sysdeps/generic/sysdep.h"
+ "glibc/sysdeps/generic/tls.h"
+ "glibc/sysdeps/hppa/bits/endian.h"
+ "glibc/sysdeps/hppa/crti.S"
+ "glibc/sysdeps/hppa/crtn.S"
+ "glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/hppa/start.S"
+ "glibc/sysdeps/hppa/sysdep.h"
+ "glibc/sysdeps/htl/bits/pthread.h"
+ "glibc/sysdeps/htl/bits/thread-shared-types.h"
+ "glibc/sysdeps/htl/libc-lockP.h"
+ "glibc/sysdeps/htl/pthread.h"
+ "glibc/sysdeps/i386/crti.S"
+ "glibc/sysdeps/i386/crtn.S"
+ "glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/i386/start.S"
+ "glibc/sysdeps/i386/symbol-hacks.h"
+ "glibc/sysdeps/i386/sysdep.h"
+ "glibc/sysdeps/ia64/crti.S"
+ "glibc/sysdeps/ia64/crtn.S"
+ "glibc/sysdeps/ia64/dl-dtprocnum.h"
+ "glibc/sysdeps/ia64/dl-sysdep.h"
+ "glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/ia64/start.S"
+ "glibc/sysdeps/ia64/sysdep.h"
+ "glibc/sysdeps/init_array/crti.S"
+ "glibc/sysdeps/init_array/crtn.S"
+ "glibc/sysdeps/m68k/bits/endian.h"
+ "glibc/sysdeps/m68k/coldfire/sysdep.h"
+ "glibc/sysdeps/m68k/crti.S"
+ "glibc/sysdeps/m68k/crtn.S"
+ "glibc/sysdeps/m68k/m680x0/sysdep.h"
+ "glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/m68k/start.S"
+ "glibc/sysdeps/m68k/symbol-hacks.h"
+ "glibc/sysdeps/m68k/sysdep.h"
+ "glibc/sysdeps/mach/hurd/bits/stat.h"
+ "glibc/sysdeps/mach/hurd/bits/typesizes.h"
+ "glibc/sysdeps/mach/hurd/dl-sysdep.h"
+ "glibc/sysdeps/mach/hurd/kernel-features.h"
+ "glibc/sysdeps/mach/i386/sysdep.h"
+ "glibc/sysdeps/mach/libc-lock.h"
+ "glibc/sysdeps/mach/sys/syscall.h"
+ "glibc/sysdeps/mach/sysdep.h"
+ "glibc/sysdeps/microblaze/bits/endian.h"
+ "glibc/sysdeps/microblaze/crti.S"
+ "glibc/sysdeps/microblaze/crtn.S"
+ "glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/microblaze/start.S"
+ "glibc/sysdeps/microblaze/sysdep.h"
+ "glibc/sysdeps/mips/bits/endian.h"
+ "glibc/sysdeps/mips/dl-dtprocnum.h"
+ "glibc/sysdeps/mips/mips32/crti.S"
+ "glibc/sysdeps/mips/mips32/crtn.S"
+ "glibc/sysdeps/mips/mips64/n32/crti.S"
+ "glibc/sysdeps/mips/mips64/n32/crtn.S"
+ "glibc/sysdeps/mips/mips64/n64/crti.S"
+ "glibc/sysdeps/mips/mips64/n64/crtn.S"
+ "glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/mips/start.S"
+ "glibc/sysdeps/nios2/bits/endian.h"
+ "glibc/sysdeps/nios2/crti.S"
+ "glibc/sysdeps/nios2/crtn.S"
+ "glibc/sysdeps/nios2/dl-sysdep.h"
+ "glibc/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/nios2/start.S"
+ "glibc/sysdeps/nios2/sysdep.h"
"glibc/sysdeps/nptl/bits/pthreadtypes.h"
"glibc/sysdeps/nptl/bits/thread-shared-types.h"
"glibc/sysdeps/nptl/libc-lock.h"
"glibc/sysdeps/nptl/libc-lockP.h"
- "glibc/sysdeps/nptl/lowlevellock.h"
"glibc/sysdeps/nptl/pthread.h"
- "glibc/sysdeps/pthread/allocalim.h"
- "glibc/sysdeps/unix/sysv/linux/bits/param.h"
- "glibc/sysdeps/unix/sysv/linux/bits/sched.h"
- "glibc/sysdeps/unix/sysv/linux/bits/signum.h"
+ "glibc/sysdeps/powerpc/bits/endian.h"
+ "glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/powerpc/powerpc32/crti.S"
+ "glibc/sysdeps/powerpc/powerpc32/crtn.S"
+ "glibc/sysdeps/powerpc/powerpc32/dl-dtprocnum.h"
+ "glibc/sysdeps/powerpc/powerpc32/start.S"
+ "glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h"
+ "glibc/sysdeps/powerpc/powerpc32/sysdep.h"
+ "glibc/sysdeps/powerpc/powerpc64/crti.S"
+ "glibc/sysdeps/powerpc/powerpc64/crtn.S"
+ "glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h"
+ "glibc/sysdeps/powerpc/powerpc64/start.S"
+ "glibc/sysdeps/powerpc/powerpc64/sysdep.h"
+ "glibc/sysdeps/powerpc/sysdep.h"
+ "glibc/sysdeps/riscv/bits/endian.h"
+ "glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/riscv/start.S"
+ "glibc/sysdeps/s390/bits/endian.h"
+ "glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/s390/s390-32/crti.S"
+ "glibc/sysdeps/s390/s390-32/crtn.S"
+ "glibc/sysdeps/s390/s390-32/dl-sysdep.h"
+ "glibc/sysdeps/s390/s390-32/start.S"
+ "glibc/sysdeps/s390/s390-32/symbol-hacks.h"
+ "glibc/sysdeps/s390/s390-32/sysdep.h"
+ "glibc/sysdeps/s390/s390-64/crti.S"
+ "glibc/sysdeps/s390/s390-64/crtn.S"
+ "glibc/sysdeps/s390/s390-64/start.S"
+ "glibc/sysdeps/s390/s390-64/sysdep.h"
+ "glibc/sysdeps/sh/bits/endian.h"
+ "glibc/sysdeps/sh/crti.S"
+ "glibc/sysdeps/sh/crtn.S"
+ "glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/sh/start.S"
+ "glibc/sysdeps/sh/sysdep.h"
+ "glibc/sysdeps/sparc/bits/endian.h"
+ "glibc/sysdeps/sparc/crti.S"
+ "glibc/sysdeps/sparc/crtn.S"
+ "glibc/sysdeps/sparc/dl-dtprocnum.h"
+ "glibc/sysdeps/sparc/dl-sysdep.h"
+ "glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h"
+ "glibc/sysdeps/sparc/sparc32/start.S"
+ "glibc/sysdeps/sparc/sparc64/start.S"
+ "glibc/sysdeps/sparc/sysdep.h"
+ "glibc/sysdeps/unix/alpha/sysdep.h"
+ "glibc/sysdeps/unix/arm/sysdep.h"
+ "glibc/sysdeps/unix/i386/sysdep.h"
+ "glibc/sysdeps/unix/mips/mips32/sysdep.h"
+ "glibc/sysdeps/unix/mips/mips64/n32/sysdep.h"
+ "glibc/sysdeps/unix/mips/mips64/n64/sysdep.h"
+ "glibc/sysdeps/unix/mips/sysdep.h"
+ "glibc/sysdeps/unix/powerpc/sysdep.h"
+ "glibc/sysdeps/unix/sh/sysdep.h"
+ "glibc/sysdeps/unix/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/aarch64/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h"
+ "glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/alpha/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/alpha/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h"
+ "glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/arm/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h"
+ "glibc/sysdeps/unix/sysv/linux/arm/sysdep.h"
"glibc/sysdeps/unix/sysv/linux/bits/stat.h"
- "glibc/sysdeps/unix/sysv/linux/bits/time.h"
"glibc/sysdeps/unix/sysv/linux/bits/timex.h"
+ "glibc/sysdeps/unix/sysv/linux/csky/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/csky/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/csky/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/dl-sysdep.h"
"glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/generic/bits/typesizes.h"
+ "glibc/sysdeps/unix/sysv/linux/generic/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/hppa/pthread.h"
+ "glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/i386/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/i386/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/ia64/asm/break.h"
+ "glibc/sysdeps/unix/sysv/linux/ia64/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/ia64/bits/endian.h"
+ "glibc/sysdeps/unix/sysv/linux/ia64/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/ia64/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/include/asm-generic/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/include/asm/unistd_32.h"
+ "glibc/sysdeps/unix/sysv/linux/include/asm/unistd_64.h"
+ "glibc/sysdeps/unix/sysv/linux/include/bits/syscall.h"
"glibc/sysdeps/unix/sysv/linux/include/sys/timex.h"
+ "glibc/sysdeps/unix/sysv/linux/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/m68k/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/m68k/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/m68k/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/m68k/m680x0/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/m68k/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/microblaze/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/microblaze/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/mips/asm/sgidefs.h"
+ "glibc/sysdeps/unix/sysv/linux/mips/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/mips/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/nios2/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/nios2/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/powerpc/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/powerpc/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/riscv/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/s390/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/s390/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h"
+ "glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h"
+ "glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/sh/sh4/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/sh/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/sparc/asm/unistd.h"
+ "glibc/sysdeps/unix/sysv/linux/sparc/bits/stat.h"
+ "glibc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h"
+ "glibc/sysdeps/unix/sysv/linux/sparc/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/sys/syscall.h"
"glibc/sysdeps/unix/sysv/linux/sys/timex.h"
+ "glibc/sysdeps/unix/sysv/linux/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/x86/asm/unistd.h"
"glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h"
"glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h"
"glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h"
- "glibc/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h"
+ "glibc/sysdeps/unix/sysv/linux/x86_64/kernel-features.h"
+ "glibc/sysdeps/unix/sysv/linux/x86_64/sysdep.h"
+ "glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h"
+ "glibc/sysdeps/unix/x86_64/sysdep.h"
"glibc/sysdeps/x86/bits/endian.h"
- "glibc/sysdeps/x86/bits/floatn.h"
"glibc/sysdeps/x86/bits/select.h"
- "glibc/sysdeps/x86/bits/setjmp.h"
"glibc/sysdeps/x86/bits/wordsize.h"
"glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h"
"glibc/sysdeps/x86/sysdep.h"
"glibc/sysdeps/x86_64/crti.S"
"glibc/sysdeps/x86_64/crtn.S"
- "glibc/sysdeps/x86_64/stackinfo.h"
"glibc/sysdeps/x86_64/start.S"
"glibc/sysdeps/x86_64/sysdep.h"
+ "glibc/sysdeps/x86_64/x32/symbol-hacks.h"
+ "glibc/sysdeps/x86_64/x32/sysdep.h"
"glibc/time/bits/types/clock_t.h"
"glibc/time/bits/types/clockid_t.h"
"glibc/time/bits/types/struct_itimerspec.h"
@@ -1405,8 +1618,6 @@ set(ZIG_LIBC_FILES
"glibc/time/bits/types/struct_tm.h"
"glibc/time/bits/types/time_t.h"
"glibc/time/bits/types/timer_t.h"
- "glibc/time/sys/time.h"
- "glibc/time/time.h"
)
set(ZIG_LIBUNWIND_FILES
diff --git a/libc/glibc/bits/param.h b/libc/glibc/bits/param.h
deleted file mode 100644
index e83f60f0b57d769640f2fef798dcdbae387345c1..0000000000000000000000000000000000000000
--- a/libc/glibc/bits/param.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Old-style Unix parameters and limits. Stub version.
- Copyright (C) 1995-2019 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
- . */
-
-#ifndef _SYS_PARAM_H
-# error "Never use directly; include instead."
-#endif
-
-/* This header is expected to define a few particular macros.
-
- The traditional BSD macros that correspond directly to POSIX
- macros don't need to be defined here if defines the
- POSIX limit macro, as the common code will define each
- traditional name to its POSIX name if available.
-
- This file should define at least:
-
- EXEC_PAGESIZE
-*/
diff --git a/libc/glibc/bits/sched.h b/libc/glibc/bits/sched.h
deleted file mode 100644
index c054a0554b39953698209a50d26be051f0a16ce3..0000000000000000000000000000000000000000
--- a/libc/glibc/bits/sched.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Definitions of constants and data structure for POSIX 1003.1b-1993
- scheduling interface.
- Copyright (C) 1996-2019 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
- . */
-
-#ifndef _BITS_SCHED_H
-#define _BITS_SCHED_H 1
-
-#ifndef _SCHED_H
-# error "Never include directly; use instead."
-#endif
-
-/* Scheduling algorithms. */
-#define SCHED_OTHER 0
-#define SCHED_FIFO 1
-#define SCHED_RR 2
-
-#include
-
-#endif /* bits/sched.h */
diff --git a/libc/glibc/bits/setjmp.h b/libc/glibc/bits/setjmp.h
deleted file mode 100644
index 9150d8d7647c755333acea7da58ddf00db4a9ab5..0000000000000000000000000000000000000000
--- a/libc/glibc/bits/setjmp.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Define the machine-dependent type `jmp_buf'. Stub version. */
-
-#ifndef _SETJMP_H
-# error "Never include directly; use instead."
-#endif
-
-typedef int __jmp_buf[1];
diff --git a/libc/glibc/bits/signum.h b/libc/glibc/bits/signum.h
deleted file mode 100644
index 8c788c8e7e45c6beafb61a162b9045915ab8cf25..0000000000000000000000000000000000000000
--- a/libc/glibc/bits/signum.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Signal number constants. Generic version.
- Copyright (C) 2017-2019 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
- . */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include directly; use instead."
-#endif
-
-#include
-
-/* This operating system does not need to override any of the generic
- signal number assignments in bits/signum-generic.h, nor to add any
- additional signal constants. */
-
-#endif /* bits/signum.h. */
diff --git a/libc/glibc/bits/time.h b/libc/glibc/bits/time.h
deleted file mode 100644
index 34a598659ba7b60938c554474090651f8d1d0063..0000000000000000000000000000000000000000
--- a/libc/glibc/bits/time.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* System-dependent timing definitions. Generic version.
- Copyright (C) 1996-2019 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
- . */
-
-/*
- * Never include this file directly; use instead.
- */
-
-#ifndef _BITS_TIME_H
-#define _BITS_TIME_H 1
-
-#include
-
-/* ISO/IEC 9899:1999 7.23.1: Components of time
- The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
- the number per second of the value returned by the `clock' function. */
-/* CAE XSH, Issue 4, Version 2:
- The value of CLOCKS_PER_SEC is required to be 1 million on all
- XSI-conformant systems. */
-#define CLOCKS_PER_SEC ((__clock_t) 1000000)
-
-#if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
- && !defined __USE_XOPEN2K
-/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
- presents the real value for clock ticks per second for the system. */
-extern long int __sysconf (int);
-# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
-#endif
-
-#ifdef __USE_POSIX199309
-/* Identifier for system-wide realtime clock. */
-# define CLOCK_REALTIME 0
-/* Monotonic system-wide clock. */
-# define CLOCK_MONOTONIC 1
-/* High-resolution timer from the CPU. */
-# define CLOCK_PROCESS_CPUTIME_ID 2
-/* Thread-specific CPU-time clock. */
-# define CLOCK_THREAD_CPUTIME_ID 3
-/* Monotonic system-wide clock, not adjusted for frequency scaling. */
-# define CLOCK_MONOTONIC_RAW 4
-/* Identifier for system-wide realtime clock, updated only on ticks. */
-# define CLOCK_REALTIME_COARSE 5
-/* Monotonic system-wide clock, updated only on ticks. */
-# define CLOCK_MONOTONIC_COARSE 6
-
-/* Flag to indicate time is absolute. */
-# define TIMER_ABSTIME 1
-#endif
-
-#endif /* bits/time.h */
diff --git a/libc/glibc/include/sched.h b/libc/glibc/include/sched.h
deleted file mode 100644
index 4abc440176a584320424a008c7ac6a5bc25bfd91..0000000000000000000000000000000000000000
--- a/libc/glibc/include/sched.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _SCHED_H
-#include
-
-#ifndef _ISOMAC
-/* Now define the internal interfaces. */
-extern int __sched_setparam (__pid_t __pid,
- const struct sched_param *__param);
-libc_hidden_proto (__sched_setparam)
-extern int __sched_getparam (__pid_t __pid, struct sched_param *__param);
-extern int __sched_setscheduler (__pid_t __pid, int __policy,
- const struct sched_param *__param);
-libc_hidden_proto (__sched_setscheduler)
-extern int __sched_getscheduler (__pid_t __pid);
-extern int __sched_yield (void);
-libc_hidden_proto (__sched_yield)
-extern int __sched_get_priority_max (int __algorithm);
-libc_hidden_proto (__sched_get_priority_max)
-extern int __sched_get_priority_min (int __algorithm);
-libc_hidden_proto (__sched_get_priority_min)
-extern int __sched_rr_get_interval (__pid_t __pid, struct timespec *__t);
-
-/* These are Linux specific. */
-extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
- int __flags, void *__arg, ...);
-libc_hidden_proto (__clone)
-extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
- size_t __child_stack_size, int __flags, void *__arg, ...);
-libc_hidden_proto (__clone2)
-/* NB: Can't use "__typeof__ (getcpu)" since getcpu is Linux specific
- and Hurd doesn't have it. */
-extern int __getcpu (unsigned int *, unsigned int *);
-libc_hidden_proto (__getcpu)
-#endif
-#endif
diff --git a/libc/glibc/include/setjmp.h b/libc/glibc/include/setjmp.h
deleted file mode 100644
index 263bc64b3daa1ab252662017539093c1a80e0ea3..0000000000000000000000000000000000000000
--- a/libc/glibc/include/setjmp.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef _SETJMP_H
-#include
-
-#ifndef _ISOMAC
-/* Now define the internal interfaces. */
-
-/* Internal machine-dependent function to restore context sans signal mask. */
-extern void __longjmp (__jmp_buf __env, int __val)
- __attribute__ ((__noreturn__)) attribute_hidden;
-
-extern void ____longjmp_chk (__jmp_buf __env, int __val)
- __attribute__ ((__noreturn__)) attribute_hidden;
-
-/* Internal function to possibly save the current mask of blocked signals
- in ENV, and always set the flag saying whether or not it was saved.
- This is used by the machine-dependent definition of `__sigsetjmp'.
- Always returns zero, for convenience. */
-extern int __sigjmp_save (jmp_buf __env, int __savemask);
-
-extern void _longjmp_unwind (jmp_buf env, int val);
-
-extern void __libc_siglongjmp (sigjmp_buf env, int val)
- __attribute__ ((noreturn));
-extern void __libc_longjmp (sigjmp_buf env, int val)
- __attribute__ ((noreturn));
-
-libc_hidden_proto (_setjmp)
-libc_hidden_proto (__sigsetjmp)
-
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
-extern __typeof (__sigsetjmp) __sigsetjmp attribute_hidden;
-# endif
-
-/* Check jmp_buf sizes, alignments and offsets. */
-# include
-# include
-
-# define STR_HELPER(x) #x
-# define STR(x) STR_HELPER(x)
-
-# define TEST_SIZE(type, size) \
- _Static_assert (sizeof (type) == size, \
- "size of " #type " != " \
- STR (size))
-# define TEST_ALIGN(type, align) \
- _Static_assert (__alignof__ (type) == align , \
- "align of " #type " != " \
- STR (align))
-# define TEST_OFFSET(type, member, offset) \
- _Static_assert (offsetof (type, member) == offset, \
- "offset of " #member " field of " #type " != " \
- STR (offset))
-
-/* Check if jmp_buf have the expected sizes. */
-TEST_SIZE (jmp_buf, JMP_BUF_SIZE);
-TEST_SIZE (sigjmp_buf, SIGJMP_BUF_SIZE);
-
-/* Check if jmp_buf have the expected alignments. */
-TEST_ALIGN (jmp_buf, JMP_BUF_ALIGN);
-TEST_ALIGN (sigjmp_buf, SIGJMP_BUF_ALIGN);
-
-/* Check if internal fields in jmp_buf have the expected offsets. */
-TEST_OFFSET (struct __jmp_buf_tag, __mask_was_saved,
- MASK_WAS_SAVED_OFFSET);
-TEST_OFFSET (struct __jmp_buf_tag, __saved_mask,
- SAVED_MASK_OFFSET);
-#endif
-
-#endif
diff --git a/libc/glibc/include/stackinfo.h b/libc/glibc/include/stackinfo.h
deleted file mode 100644
index c002cf718bc055263045e97a24a900facefcc9d7..0000000000000000000000000000000000000000
--- a/libc/glibc/include/stackinfo.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Details about the machine's stack: wrapper header.
- Copyright (C) 2014-2019 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
- . */
-
-#ifndef _INCLUDE_STACKINFO_H
-#define _INCLUDE_STACKINFO_H 1
-
-/* A sysdeps/.../stackinfo.h file defines details for the CPU.
- It is obliged to define either _STACK_GROWS_DOWN or _STACK_GROWS_UP. */
-#include_next
-
-#if defined _STACK_GROWS_DOWN && _STACK_GROWS_DOWN
-# ifdef _STACK_GROWS_UP
-# error "stackinfo.h should not define both!"
-# else
-# define _STACK_GROWS_UP 0
-# endif
-#elif defined _STACK_GROWS_UP && _STACK_GROWS_UP
-# ifdef _STACK_GROWS_DOWN
-# error "stackinfo.h should not define both!"
-# else
-# define _STACK_GROWS_DOWN 0
-# endif
-#else
-# error "stackinfo.h must define _STACK_GROWS_UP or _STACK_GROWS_DOWN!"
-#endif
-
-#endif /* include/stackinfo.h */
diff --git a/libc/glibc/include/sys/param.h b/libc/glibc/include/sys/param.h
deleted file mode 100644
index 7a0cfb1f248fdb8a393cc6a0684e886ce819d9e3..0000000000000000000000000000000000000000
--- a/libc/glibc/include/sys/param.h
+++ /dev/null
@@ -1 +0,0 @@
-#include
diff --git a/libc/glibc/include/sys/time.h b/libc/glibc/include/sys/time.h
deleted file mode 100644
index 7ba0ca7c2dec4d65c90c348b7a4a83415180d57d..0000000000000000000000000000000000000000
--- a/libc/glibc/include/sys/time.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Time function internal interfaces.
- Copyright (C) 1997-2019 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
- . */
-
-#ifndef _SYS_TIME_H
-# include
-
-# ifndef _ISOMAC
-extern int __gettimeofday (struct timeval *__tv,
- struct timezone *__tz);
-libc_hidden_proto (__gettimeofday)
-libc_hidden_proto (gettimeofday)
-extern int __settimeofday (const struct timeval *__tv,
- const struct timezone *__tz)
- attribute_hidden;
-extern int __adjtime (const struct timeval *__delta,
- struct timeval *__olddelta);
-extern int __getitimer (enum __itimer_which __which,
- struct itimerval *__value);
-extern int __setitimer (enum __itimer_which __which,
- const struct itimerval *__restrict __new,
- struct itimerval *__restrict __old)
- attribute_hidden;
-extern int __utimes (const char *__file, const struct timeval __tvp[2])
- attribute_hidden;
-extern int __futimes (int fd, const struct timeval tvp[2]) attribute_hidden;
-
-# endif
-#endif
diff --git a/libc/glibc/include/syscall.h b/libc/glibc/include/syscall.h
new file mode 100644
index 0000000000000000000000000000000000000000..8c53cfb204efe2fd910d707036d0fcca40eccfc7
--- /dev/null
+++ b/libc/glibc/include/syscall.h
@@ -0,0 +1 @@
+#include
diff --git a/libc/glibc/include/time.h b/libc/glibc/include/time.h
deleted file mode 100644
index f935e9dd3e07daa4d49f60f6318a9a80eb0235a2..0000000000000000000000000000000000000000
--- a/libc/glibc/include/time.h
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef _TIME_H
-#include
-
-#ifndef _ISOMAC
-# include
-
-extern __typeof (strftime_l) __strftime_l;
-libc_hidden_proto (__strftime_l)
-extern __typeof (strptime_l) __strptime_l;
-
-libc_hidden_proto (time)
-libc_hidden_proto (asctime)
-libc_hidden_proto (mktime)
-libc_hidden_proto (timelocal)
-libc_hidden_proto (localtime)
-libc_hidden_proto (strftime)
-libc_hidden_proto (strptime)
-
-extern __typeof (clock_getres) __clock_getres;
-extern __typeof (clock_gettime) __clock_gettime;
-libc_hidden_proto (__clock_gettime)
-extern __typeof (clock_settime) __clock_settime;
-extern __typeof (clock_nanosleep) __clock_nanosleep;
-extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
-
-/* Now define the internal interfaces. */
-struct tm;
-
-/* Defined in mktime.c. */
-extern const unsigned short int __mon_yday[2][13] attribute_hidden;
-
-/* Defined in localtime.c. */
-extern struct tm _tmbuf attribute_hidden;
-
-/* Defined in tzset.c. */
-extern char *__tzstring (const char *string) attribute_hidden;
-
-extern int __use_tzfile attribute_hidden;
-
-extern void __tzfile_read (const char *file, size_t extra,
- char **extrap) attribute_hidden;
-extern void __tzfile_compute (__time64_t timer, int use_localtime,
- long int *leap_correct, int *leap_hit,
- struct tm *tp) attribute_hidden;
-extern void __tzfile_default (const char *std, const char *dst,
- long int stdoff, long int dstoff)
- attribute_hidden;
-extern void __tzset_parse_tz (const char *tz) attribute_hidden;
-extern void __tz_compute (__time64_t timer, struct tm *tm, int use_localtime)
- __THROW attribute_hidden;
-
-/* Subroutine of `mktime'. Return the `time_t' representation of TP and
- normalize TP, given that a `struct tm *' maps to a `time_t' as performed
- by FUNC. Record next guess for localtime-gmtime offset in *OFFSET. */
-extern time_t __mktime_internal (struct tm *__tp,
- struct tm *(*__func) (const time_t *,
- struct tm *),
- long int *__offset) attribute_hidden;
-
-#if __TIMESIZE == 64
-# define __ctime64 ctime
-#else
-extern char *__ctime64 (const __time64_t *__timer) __THROW;
-libc_hidden_proto (__ctime64);
-#endif
-
-#if __TIMESIZE == 64
-# define __ctime64_r ctime_r
-#else
-extern char *__ctime64_r (const __time64_t *__restrict __timer,
- char *__restrict __buf) __THROW;
-libc_hidden_proto (__ctime64_r);
-#endif
-
-#if __TIMESIZE == 64
-# define __localtime64 localtime
-#else
-extern struct tm *__localtime64 (const __time64_t *__timer);
-libc_hidden_proto (__localtime64)
-#endif
-
-extern struct tm *__localtime_r (const time_t *__timer,
- struct tm *__tp) attribute_hidden;
-
-#if __TIMESIZE == 64
-# define __localtime64_r __localtime_r
-#else
-extern struct tm *__localtime64_r (const __time64_t *__timer,
- struct tm *__tp);
-libc_hidden_proto (__localtime64_r)
-#endif
-
-extern struct tm *__gmtime_r (const time_t *__restrict __timer,
- struct tm *__restrict __tp);
-libc_hidden_proto (__gmtime_r)
-
-#if __TIMESIZE == 64
-# define __gmtime64 gmtime
-#else
-extern struct tm *__gmtime64 (const __time64_t *__timer);
-libc_hidden_proto (__gmtime64)
-#endif
-
-#if __TIMESIZE == 64
-# define __gmtime64_r __gmtime_r
-#else
-extern struct tm *__gmtime64_r (const __time64_t *__restrict __timer,
- struct tm *__restrict __tp);
-libc_hidden_proto (__gmtime64_r);
-#endif
-
-/* Compute the `struct tm' representation of T,
- offset OFFSET seconds east of UTC,
- and store year, yday, mon, mday, wday, hour, min, sec into *TP.
- Return nonzero if successful. */
-extern int __offtime (__time64_t __timer,
- long int __offset,
- struct tm *__tp) attribute_hidden;
-
-extern char *__asctime_r (const struct tm *__tp, char *__buf)
- attribute_hidden;
-extern void __tzset (void) attribute_hidden;
-
-/* Prototype for the internal function to get information based on TZ. */
-extern struct tm *__tz_convert (__time64_t timer, int use_localtime,
- struct tm *tp) attribute_hidden;
-
-extern int __nanosleep (const struct timespec *__requested_time,
- struct timespec *__remaining);
-hidden_proto (__nanosleep)
-extern int __getdate_r (const char *__string, struct tm *__resbufp)
- attribute_hidden;
-
-
-/* Determine CLK_TCK value. */
-extern int __getclktck (void) attribute_hidden;
-
-
-/* strptime support. */
-extern char * __strptime_internal (const char *rp, const char *fmt,
- struct tm *tm, void *statep,
- locale_t locparam) attribute_hidden;
-
-#if __TIMESIZE == 64
-# define __difftime64 __difftime
-#else
-extern double __difftime64 (__time64_t time1, __time64_t time0);
-libc_hidden_proto (__difftime64)
-#endif
-
-extern double __difftime (time_t time1, time_t time0);
-
-
-/* Use in the clock_* functions. Size of the field representing the
- actual clock ID. */
-#define CLOCK_IDFIELD_SIZE 3
-
-#endif
-#endif
diff --git a/libc/glibc/misc/sys/param.h b/libc/glibc/misc/sys/param.h
deleted file mode 100644
index bf988a9769bc298874c236daf740757325634843..0000000000000000000000000000000000000000
--- a/libc/glibc/misc/sys/param.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Compatibility header for old-style Unix parameters and limits.
- Copyright (C) 1995-2019 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
- . */
-
-#ifndef _SYS_PARAM_H
-#define _SYS_PARAM_H 1
-
-#define __need_NULL
-#include
-
-#include
-#include
-#include /* Define BYTE_ORDER et al. */
-#include /* Define NSIG. */
-
-/* This file defines some things in system-specific ways. */
-#include
-
-
-/* BSD names for some values. */
-
-#define NBBY CHAR_BIT
-
-#if !defined NGROUPS && defined NGROUPS_MAX
-# define NGROUPS NGROUPS_MAX
-#endif
-#if !defined MAXSYMLINKS && defined SYMLOOP_MAX
-# define MAXSYMLINKS SYMLOOP_MAX
-#endif
-#if !defined CANBSIZ && defined MAX_CANON
-# define CANBSIZ MAX_CANON
-#endif
-#if !defined MAXPATHLEN && defined PATH_MAX
-# define MAXPATHLEN PATH_MAX
-#endif
-#if !defined NOFILE && defined OPEN_MAX
-# define NOFILE OPEN_MAX
-#endif
-#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX
-# define MAXHOSTNAMELEN HOST_NAME_MAX
-#endif
-#ifndef NCARGS
-# ifdef ARG_MAX
-# define NCARGS ARG_MAX
-# else
-/* ARG_MAX is unlimited, but we define NCARGS for BSD programs that want to
- compare against some fixed limit. */
-# define NCARGS INT_MAX
-# endif
-#endif
-
-
-/* Magical constants. */
-#ifndef NOGROUP
-# define NOGROUP 65535 /* Marker for empty group set member. */
-#endif
-#ifndef NODEV
-# define NODEV ((dev_t) -1) /* Non-existent device. */
-#endif
-
-
-/* Unit of `st_blocks'. */
-#ifndef DEV_BSIZE
-# define DEV_BSIZE 512
-#endif
-
-
-/* Bit map related macros. */
-#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
-#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
-#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
-#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
-
-/* Macros for counting and rounding. */
-#ifndef howmany
-# define howmany(x, y) (((x) + ((y) - 1)) / (y))
-#endif
-#ifdef __GNUC__
-# define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \
- ? (((x) + (y) - 1) & ~((y) - 1)) \
- : ((((x) + ((y) - 1)) / (y)) * (y)))
-#else
-# define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
-#endif
-#define powerof2(x) ((((x) - 1) & (x)) == 0)
-
-/* Macros for min/max. */
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
-
-
-#endif /* sys/param.h */
diff --git a/libc/glibc/misc/syscall.h b/libc/glibc/misc/syscall.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c305784472f8bbcd05f4952dd01934d8d7c2175
--- /dev/null
+++ b/libc/glibc/misc/syscall.h
@@ -0,0 +1 @@
+#include
diff --git a/libc/glibc/posix/sched.h b/libc/glibc/posix/sched.h
deleted file mode 100644
index 90ef6fcfd1b1e488b04809d30fd4532a58bd5aa7..0000000000000000000000000000000000000000
--- a/libc/glibc/posix/sched.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
- Copyright (C) 1996-2019 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
- . */
-
-#ifndef _SCHED_H
-#define _SCHED_H 1
-
-#include
-
-/* Get type definitions. */
-#include
-
-#define __need_size_t
-#define __need_NULL
-#include
-
-#include
-#include
-#ifndef __USE_XOPEN2K
-# include
-#endif
-
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
-#endif
-
-/* Get system specific constant and data structure definitions. */
-#include
-#include
-
-/* Backward compatibility. */
-#define sched_priority sched_priority
-#define __sched_priority sched_priority
-
-
-__BEGIN_DECLS
-
-/* Set scheduling parameters for a process. */
-extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
- __THROW;
-
-/* Retrieve scheduling parameters for a particular process. */
-extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW;
-
-/* Set scheduling algorithm and/or parameters for a process. */
-extern int sched_setscheduler (__pid_t __pid, int __policy,
- const struct sched_param *__param) __THROW;
-
-/* Retrieve scheduling algorithm for a particular purpose. */
-extern int sched_getscheduler (__pid_t __pid) __THROW;
-
-/* Yield the processor. */
-extern int sched_yield (void) __THROW;
-
-/* Get maximum priority value for a scheduler. */
-extern int sched_get_priority_max (int __algorithm) __THROW;
-
-/* Get minimum priority value for a scheduler. */
-extern int sched_get_priority_min (int __algorithm) __THROW;
-
-/* Get the SCHED_RR interval for the named process. */
-extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
-
-
-#ifdef __USE_GNU
-/* Access macros for `cpu_set'. */
-# define CPU_SETSIZE __CPU_SETSIZE
-# define CPU_SET(cpu, cpusetp) __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp)
-# define CPU_CLR(cpu, cpusetp) __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp)
-# define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \
- cpusetp)
-# define CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
-# define CPU_COUNT(cpusetp) __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)
-
-# define CPU_SET_S(cpu, setsize, cpusetp) __CPU_SET_S (cpu, setsize, cpusetp)
-# define CPU_CLR_S(cpu, setsize, cpusetp) __CPU_CLR_S (cpu, setsize, cpusetp)
-# define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \
- cpusetp)
-# define CPU_ZERO_S(setsize, cpusetp) __CPU_ZERO_S (setsize, cpusetp)
-# define CPU_COUNT_S(setsize, cpusetp) __CPU_COUNT_S (setsize, cpusetp)
-
-# define CPU_EQUAL(cpusetp1, cpusetp2) \
- __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2)
-# define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
- __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2)
-
-# define CPU_AND(destset, srcset1, srcset2) \
- __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &)
-# define CPU_OR(destset, srcset1, srcset2) \
- __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |)
-# define CPU_XOR(destset, srcset1, srcset2) \
- __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^)
-# define CPU_AND_S(setsize, destset, srcset1, srcset2) \
- __CPU_OP_S (setsize, destset, srcset1, srcset2, &)
-# define CPU_OR_S(setsize, destset, srcset1, srcset2) \
- __CPU_OP_S (setsize, destset, srcset1, srcset2, |)
-# define CPU_XOR_S(setsize, destset, srcset1, srcset2) \
- __CPU_OP_S (setsize, destset, srcset1, srcset2, ^)
-
-# define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count)
-# define CPU_ALLOC(count) __CPU_ALLOC (count)
-# define CPU_FREE(cpuset) __CPU_FREE (cpuset)
-
-
-/* Set the CPU affinity for a task */
-extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
- const cpu_set_t *__cpuset) __THROW;
-
-/* Get the CPU affinity for a task */
-extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
- cpu_set_t *__cpuset) __THROW;
-#endif
-
-__END_DECLS
-
-#endif /* sched.h */
diff --git a/libc/glibc/setjmp/setjmp.h b/libc/glibc/setjmp/setjmp.h
deleted file mode 100644
index 3d09c98cc93f8b31b885984ef291e912f56b6928..0000000000000000000000000000000000000000
--- a/libc/glibc/setjmp/setjmp.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright (C) 1991-2019 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
- . */
-
-/*
- * ISO C99 Standard: 7.13 Nonlocal jumps
- */
-
-#ifndef _SETJMP_H
-#define _SETJMP_H 1
-
-#include
-
-__BEGIN_DECLS
-
-#include /* Get `__jmp_buf'. */
-#include
-
-/* 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. */
- };
-
-
-typedef struct __jmp_buf_tag jmp_buf[1];
-
-/* Store the calling environment in ENV, also saving the signal mask.
- Return 0. */
-extern int setjmp (jmp_buf __env) __THROWNL;
-
-/* Store the calling environment in ENV, also saving the
- signal mask if SAVEMASK is nonzero. Return 0.
- This is the internal name for `sigsetjmp'. */
-extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
-
-/* Store the calling environment in ENV, not saving the signal mask.
- Return 0. */
-extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
-
-/* Do not save the signal mask. This is equivalent to the `_setjmp'
- BSD function. */
-#define setjmp(env) _setjmp (env)
-
-
-/* Jump to the environment saved in ENV, making the
- `setjmp' call there return VAL, or 1 if VAL is 0. */
-extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROWNL __attribute__ ((__noreturn__));
-
-#if defined __USE_MISC || defined __USE_XOPEN
-/* Same. Usually `_longjmp' is used with `_setjmp', which does not save
- the signal mask. But it is how ENV was saved that determines whether
- `longjmp' restores the mask; `_longjmp' is just an alias. */
-extern void _longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROWNL __attribute__ ((__noreturn__));
-#endif
-
-
-#ifdef __USE_POSIX
-/* Use the same type for `jmp_buf' and `sigjmp_buf'.
- The `__mask_was_saved' flag determines whether
- or not `longjmp' will restore the signal mask. */
-typedef struct __jmp_buf_tag sigjmp_buf[1];
-
-/* Store the calling environment in ENV, also saving the
- signal mask if SAVEMASK is nonzero. Return 0. */
-# define sigsetjmp(env, savemask) __sigsetjmp (env, savemask)
-
-/* Jump to the environment saved in ENV, making the
- sigsetjmp call there return VAL, or 1 if VAL is 0.
- Restore the signal mask if that sigsetjmp call saved it.
- This is just an alias `longjmp'. */
-extern void siglongjmp (sigjmp_buf __env, int __val)
- __THROWNL __attribute__ ((__noreturn__));
-#endif /* Use POSIX. */
-
-
-/* Define helper functions to catch unsafe code. */
-#if __USE_FORTIFY_LEVEL > 0
-# include
-#endif
-
-__END_DECLS
-
-#endif /* setjmp.h */
diff --git a/libc/glibc/sysdeps/aarch64/bits/endian.h b/libc/glibc/sysdeps/aarch64/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..c0a40e082aece0d1ef83be3f072876d6c8c9f9a2
--- /dev/null
+++ b/libc/glibc/sysdeps/aarch64/bits/endian.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 1997-2019 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
+ . */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* AArch64 can be either big or little endian. */
+#ifdef __AARCH64EB__
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#define __FLOAT_WORD_ORDER __BYTE_ORDER
diff --git a/libc/glibc/sysdeps/aarch64/crti.S b/libc/glibc/sysdeps/aarch64/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..d4e7dfcf5cf48172a47d768f3a61e11119f18d16
--- /dev/null
+++ b/libc/glibc/sysdeps/aarch64/crti.S
@@ -0,0 +1,93 @@
+/* Special .init and .fini section support for AArch64.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ .align 2
+ .type call_weak_fn, %function
+call_weak_fn:
+ adrp x0, :got:PREINIT_FUNCTION
+ ldr PTR_REG (0), [x0, #:got_lo12:PREINIT_FUNCTION]
+ cbz x0, 1f
+ b PREINIT_FUNCTION
+1:
+ RET
+ .size call_weak_fn, .-call_weak_fn
+#endif
+
+ .section .init,"ax",%progbits
+ .align 2
+ .global _init
+ .hidden _init
+ .type _init, %function
+_init:
+ stp x29, x30, [sp, -16]!
+ mov x29, sp
+#if PREINIT_FUNCTION_WEAK
+ bl call_weak_fn
+#else
+ bl PREINIT_FUNCTION
+#endif
+
+ .section .fini,"ax",%progbits
+ .align 2
+ .global _fini
+ .hidden _fini
+ .type _fini, %function
+_fini:
+ stp x29, x30, [sp, -16]!
+ mov x29, sp
diff --git a/libc/glibc/sysdeps/aarch64/crtn.S b/libc/glibc/sysdeps/aarch64/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..363f752460f83fe35ecf8c1ca14d04b73336ec46
--- /dev/null
+++ b/libc/glibc/sysdeps/aarch64/crtn.S
@@ -0,0 +1,46 @@
+/* Special .init and .fini section support for AArch64.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",%progbits
+ ldp x29, x30, [sp], 16
+ RET
+
+ .section .fini,"ax",%progbits
+ ldp x29, x30, [sp], 16
+ RET
diff --git a/libc/glibc/sysdeps/aarch64/dl-sysdep.h b/libc/glibc/sysdeps/aarch64/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..0db7125fbedd7a9a0a1a1728a7c32fe33dd7ec39
--- /dev/null
+++ b/libc/glibc/sysdeps/aarch64/dl-sysdep.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2002-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
+
+#define DL_EXTERN_PROTECTED_DATA
diff --git a/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a2a5155db0ca8655f2bb4dbc60b6556f3a08662
--- /dev/null
+++ b/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,71 @@
+/* Copyright (C) 2002-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#ifdef __ILP32__
+# define __SIZEOF_PTHREAD_ATTR_T 32
+# define __SIZEOF_PTHREAD_MUTEX_T 32
+# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 48
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 64
+# define __SIZEOF_PTHREAD_MUTEX_T 48
+# define __SIZEOF_PTHREAD_MUTEXATTR_T 8
+# define __SIZEOF_PTHREAD_CONDATTR_T 8
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+# define __SIZEOF_PTHREAD_BARRIERATTR_T 8
+#endif
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
+#define __PTHREAD_MUTEX_USE_UNION 0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/aarch64/start.S b/libc/glibc/sysdeps/aarch64/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..f5e9b9c2238874a76963bfcb7f2c93c3b6a16516
--- /dev/null
+++ b/libc/glibc/sysdeps/aarch64/start.S
@@ -0,0 +1,112 @@
+/* Copyright (C) 1995-2019 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
+ . */
+
+#include
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment.
+
+ Note that the code in the .init section has already been run.
+ This includes _init and _libc_init
+
+
+ At this entry point, most registers' values are unspecified, except:
+
+ x0/w0 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ sp The stack contains the arguments and environment:
+ 0(sp) argc
+ 8(sp) argv[0]
+ ...
+ (8*argc)(sp) NULL
+ (8*(argc+1))(sp) envp[0]
+ ...
+ NULL
+ */
+
+ .text
+ .globl _start
+ .type _start,#function
+_start:
+ /* Create an initial frame with 0 LR and FP */
+ mov x29, #0
+ mov x30, #0
+
+ /* Setup rtld_fini in argument register */
+ mov x5, x0
+
+ /* Load argc and a pointer to argv */
+ ldr PTR_REG (1), [sp, #0]
+ add x2, sp, #PTR_SIZE
+
+ /* Setup stack limit in argument register */
+ mov x6, sp
+
+#ifdef PIC
+# ifdef SHARED
+ adrp x0, :got:main
+ ldr PTR_REG (0), [x0, #:got_lo12:main]
+
+ adrp x3, :got:__libc_csu_init
+ ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
+
+ adrp x4, :got:__libc_csu_fini
+ ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
+# else
+ adrp x0, __wrap_main
+ add x0, x0, :lo12:__wrap_main
+ adrp x3, __libc_csu_init
+ add x3, x3, :lo12:__libc_csu_init
+ adrp x4, __libc_csu_fini
+ add x4, x4, :lo12:__libc_csu_fini
+# endif
+#else
+ /* Set up the other arguments in registers */
+ MOVL (0, main)
+ MOVL (3, __libc_csu_init)
+ MOVL (4, __libc_csu_fini)
+#endif
+
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
+ stack_end) */
+
+ /* Let the libc call main and exit with its return code. */
+ bl __libc_start_main
+
+ /* should never get here....*/
+ bl abort
+
+#if defined PIC && !defined SHARED
+ /* When main is not defined in the executable but in a shared library
+ then a wrapper is needed in crt1.o of the static-pie enabled libc,
+ because crt1.o and rcrt1.o share code and the later must avoid the
+ use of GOT relocations before __libc_start_main is called. */
+__wrap_main:
+ b main
+#endif
+
+ /* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/aarch64/sysdep.h b/libc/glibc/sysdeps/aarch64/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..d3ff68589597cd58297a8630c9f9d45fb741988d
--- /dev/null
+++ b/libc/glibc/sysdeps/aarch64/sysdep.h
@@ -0,0 +1,162 @@
+/* Copyright (C) 1997-2019 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
+ . */
+
+#ifndef _AARCH64_SYSDEP_H
+#define _AARCH64_SYSDEP_H
+
+#include
+
+#ifdef __LP64__
+# define AARCH64_R(NAME) R_AARCH64_ ## NAME
+# define PTR_REG(n) x##n
+# define PTR_LOG_SIZE 3
+# define DELOUSE(n)
+#else
+# define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
+# define PTR_REG(n) w##n
+# define PTR_LOG_SIZE 2
+# define DELOUSE(n) mov w##n, w##n
+#endif
+
+#define PTR_SIZE (1< directly; include instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/libc/glibc/sysdeps/alpha/crti.S b/libc/glibc/sysdeps/alpha/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..05b62a147de575d2c4b3db1ba5fe295663eaf210
--- /dev/null
+++ b/libc/glibc/sysdeps/alpha/crti.S
@@ -0,0 +1,101 @@
+/* Special .init and .fini section support for Alpha.
+ Copyright (C) 2001-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI.
+
+ This differs from what would be generated for ordinary code in that
+ we save and restore the GP within the function. In order for linker
+ relaxation to work, the value in the GP register on exit from a function
+ must be valid for the function entry point. Normally, a function is
+ contained within one object file and this is not an issue, provided
+ that the function reloads the gp after making any function calls.
+ However, _init and _fini are constructed from pieces of many object
+ files, all of which may have different GP values. So we must reload
+ the GP value from crti.o in crtn.o. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init, "ax", @progbits
+ .globl _init
+ .hidden _init
+ .type _init, @function
+ .usepv _init, std
+_init:
+ ldgp $29, 0($27)
+ subq $30, 16, $30
+#if PREINIT_FUNCTION_WEAK
+ lda $27, PREINIT_FUNCTION
+#endif
+ stq $26, 0($30)
+ stq $29, 8($30)
+#if PREINIT_FUNCTION_WEAK
+ beq $27, 1f
+ jsr $26, ($27), PREINIT_FUNCTION
+ ldq $29, 8($30)
+1:
+#else
+ bsr $26, PREINIT_FUNCTION !samegp
+#endif
+ .p2align 3
+
+ .section .fini, "ax", @progbits
+ .globl _fini
+ .hidden _fini
+ .type _fini,@function
+ .usepv _fini,std
+_fini:
+ ldgp $29, 0($27)
+ subq $30, 16, $30
+ stq $26, 0($30)
+ stq $29, 8($30)
+ .p2align 3
diff --git a/libc/glibc/sysdeps/alpha/crtn.S b/libc/glibc/sysdeps/alpha/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..cdb4d1c54d3cfd9522cefb8f17097c2fab38b51d
--- /dev/null
+++ b/libc/glibc/sysdeps/alpha/crtn.S
@@ -0,0 +1,49 @@
+/* Special .init and .fini section support for Alpha.
+ Copyright (C) 2001-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init, "ax", @progbits
+ ldq $26, 0($30)
+ ldq $29, 8($30)
+ addq $30, 16, $30
+ ret
+
+ .section .fini, "ax", @progbits
+ ldq $26, 0($30)
+ ldq $29, 8($30)
+ addq $30, 16, $30
+ ret
diff --git a/libc/glibc/sysdeps/alpha/dl-dtprocnum.h b/libc/glibc/sysdeps/alpha/dl-dtprocnum.h
new file mode 100644
index 0000000000000000000000000000000000000000..67845cdd62636dc3e09604e67a7f5b475af4747c
--- /dev/null
+++ b/libc/glibc/sysdeps/alpha/dl-dtprocnum.h
@@ -0,0 +1,3 @@
+/* Number of extra dynamic section entries for this architecture. By
+ default there are none. */
+#define DT_THISPROCNUM DT_ALPHA_NUM
diff --git a/libc/glibc/sysdeps/alpha/dl-sysdep.h b/libc/glibc/sysdeps/alpha/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8c0029002ce879b86f8507e1d6a60a7e849e89f
--- /dev/null
+++ b/libc/glibc/sysdeps/alpha/dl-sysdep.h
@@ -0,0 +1,23 @@
+/* System-specific settings for dynamic linker code. Alpha version.
+ Copyright (C) 2002-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
diff --git a/libc/glibc/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..70d77fac59d23c753fe3b6d4c4776359b872fa29
--- /dev/null
+++ b/libc/glibc/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,61 @@
+/* Machine-specific pthread type layouts. Alpha version.
+ Copyright (C) 2003-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#define __SIZEOF_PTHREAD_ATTR_T 56
+#define __SIZEOF_PTHREAD_MUTEX_T 40
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 56
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 32
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
+#define __PTHREAD_MUTEX_USE_UNION 0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/alpha/start.S b/libc/glibc/sysdeps/alpha/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..85e41560103cb3492d872bcee7232707ef7392b6
--- /dev/null
+++ b/libc/glibc/sysdeps/alpha/start.S
@@ -0,0 +1,85 @@
+/* Startup code for Alpha/ELF.
+ Copyright (C) 1993-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson
+
+ 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
+ . */
+
+#include
+
+ .text
+ .align 3
+ .globl _start
+ .ent _start, 0
+ .type _start,@function
+_start:
+ .frame $15, 0, $15
+ br gp, 1f
+1: ldgp gp, 0(gp)
+ subq sp, 16, sp
+ mov 0, $15
+ .prologue 0
+
+ /* Load address of the user's main function. */
+ lda a0, main
+
+ ldl a1, 16(sp) /* get argc */
+ lda a2, 24(sp) /* get argv */
+
+ /* Load address of our own entry points to .fini and .init. */
+ lda a3, __libc_csu_init
+ lda a4, __libc_csu_fini
+
+ /* Store address of the shared library termination function. */
+ mov v0, a5
+
+ /* Provide the highest stack address to the user code. */
+ stq sp, 0(sp)
+
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
+ jsr ra, __libc_start_main
+
+ /* Die very horribly if exit returns. Call_pal hlt is callable from
+ kernel mode only; this will result in an illegal instruction trap. */
+ call_pal 0
+ .end _start
+
+/* For ECOFF backwards compatibility. */
+weak_alias (_start, __start)
+
+/* 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/glibc/sysdeps/arm/bits/endian.h b/libc/glibc/sysdeps/arm/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..f49f6ab1c9b3a108fad08e80063cb534ae79b049
--- /dev/null
+++ b/libc/glibc/sysdeps/arm/bits/endian.h
@@ -0,0 +1,10 @@
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* ARM can be either big or little endian. */
+#ifdef __ARMEB__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/libc/glibc/sysdeps/arm/crti.S b/libc/glibc/sysdeps/arm/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..26dbba66a35ae2d77c368ebb4b2a565fc3ec2f56
--- /dev/null
+++ b/libc/glibc/sysdeps/arm/crti.S
@@ -0,0 +1,97 @@
+/* Special .init and .fini section support for ARM.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+/* Always build .init and .fini sections in ARM mode. */
+#define NO_THUMB
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ .p2align 2
+ .type call_weak_fn, %function
+call_weak_fn:
+ ldr r3, .LGOT
+ ldr r2, .LGOT+4
+.LPIC:
+ add r3, pc, r3
+ ldr r2, [r3, r2]
+ cmp r2, #0
+ bxeq lr
+ b PREINIT_FUNCTION
+ .p2align 2
+.LGOT:
+ .word _GLOBAL_OFFSET_TABLE_-(.LPIC+8)
+ .word PREINIT_FUNCTION(GOT)
+#endif
+
+ .section .init,"ax",%progbits
+ .p2align 2
+ .globl _init
+ .hidden _init
+ .type _init, %function
+_init:
+ push {r3, lr}
+#if PREINIT_FUNCTION_WEAK
+ bl call_weak_fn
+#else
+ bl PREINIT_FUNCTION
+#endif
+
+ .section .fini,"ax",%progbits
+ .p2align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, %function
+_fini:
+ push {r3, lr}
diff --git a/libc/glibc/sysdeps/arm/crtn.S b/libc/glibc/sysdeps/arm/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..8f91c8d88be636dd665f151242bfbc971400ae83
--- /dev/null
+++ b/libc/glibc/sysdeps/arm/crtn.S
@@ -0,0 +1,57 @@
+/* Special .init and .fini section support for ARM.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* Always build .init and .fini sections in ARM mode. */
+#define NO_THUMB
+#include
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",%progbits
+#ifdef __ARM_ARCH_4T__
+ pop {r3, lr}
+ bx lr
+#else
+ pop {r3, pc}
+#endif
+
+ .section .fini,"ax",%progbits
+#ifdef __ARM_ARCH_4T__
+ pop {r3, lr}
+ bx lr
+#else
+ pop {r3, pc}
+#endif
diff --git a/libc/glibc/sysdeps/arm/dl-sysdep.h b/libc/glibc/sysdeps/arm/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..0cdb5efb0776f8153968bcde303875f49f1dc809
--- /dev/null
+++ b/libc/glibc/sysdeps/arm/dl-sysdep.h
@@ -0,0 +1,25 @@
+/* System-specific settings for dynamic linker code. Alpha version.
+ Copyright (C) 2002-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
+
+#define DL_EXTERN_PROTECTED_DATA
diff --git a/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..332b288067909cccb99e52aa5082dcb41f6a97ad
--- /dev/null
+++ b/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,71 @@
+/* Copyright (C) 2002-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 32
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
+#define __PTHREAD_MUTEX_USE_UNION 1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+#else
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/arm/start.S b/libc/glibc/sysdeps/arm/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..a05f8a46513ff1ea19dfd3526ed8a852b1c76557
--- /dev/null
+++ b/libc/glibc/sysdeps/arm/start.S
@@ -0,0 +1,148 @@
+/* Startup code for ARM & ELF
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment.
+
+ Note that the code in the .init section has already been run.
+ This includes _init and _libc_init
+
+
+ At this entry point, most registers' values are unspecified, except:
+
+ a1 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ sp The stack contains the arguments and environment:
+ 0(sp) argc
+ 4(sp) argv[0]
+ ...
+ (4*argc)(sp) NULL
+ (4*(argc+1))(sp) envp[0]
+ ...
+ NULL
+*/
+
+/* Tag_ABI_align8_preserved: This code preserves 8-byte
+ alignment in any callee. */
+ .eabi_attribute 25, 1
+/* Tag_ABI_align8_needed: This code may require 8-byte alignment from
+ the caller. */
+ .eabi_attribute 24, 1
+
+#if defined(__thumb2__)
+ .thumb
+ .syntax unified
+#endif
+
+ .text
+ .globl _start
+ .type _start,#function
+_start:
+ /* Protect against unhandled exceptions. */
+ .fnstart
+ /* Clear the frame pointer and link register since this is the outermost frame. */
+ mov fp, #0
+ mov lr, #0
+
+ /* Pop argc off the stack and save a pointer to argv */
+ pop { a2 }
+ mov a3, sp
+
+ /* Push stack limit */
+ push { a3 }
+
+ /* Push rtld_fini */
+ push { a1 }
+
+#ifdef PIC
+ ldr sl, .L_GOT
+ adr a4, .L_GOT
+ add sl, sl, a4
+
+ ldr ip, .L_GOT+4 /* __libc_csu_fini */
+ ldr ip, [sl, ip]
+
+ push { ip } /* Push __libc_csu_fini */
+
+ ldr a4, .L_GOT+8 /* __libc_csu_init */
+ ldr a4, [sl, a4]
+
+ ldr a1, .L_GOT+12 /* main */
+ ldr a1, [sl, a1]
+
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+ /* Let the libc call main and exit with its return code. */
+ bl __libc_start_main(PLT)
+#else
+ /* Fetch address of __libc_csu_fini */
+ ldr ip, =__libc_csu_fini
+
+ /* Push __libc_csu_fini */
+ push { ip }
+
+ /* Set up the other arguments in registers */
+ ldr a1, =main
+ ldr a4, =__libc_csu_init
+
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+ /* Let the libc call main and exit with its return code. */
+ bl __libc_start_main
+#endif
+
+ /* should never get here....*/
+ bl abort
+
+#ifdef PIC
+ .align 2
+.L_GOT:
+ .word _GLOBAL_OFFSET_TABLE_ - .L_GOT
+ .word __libc_csu_fini(GOT)
+ .word __libc_csu_init(GOT)
+ .word main(GOT)
+#endif
+
+ .cantunwind
+ .fnend
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/arm/sysdep.h b/libc/glibc/sysdeps/arm/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..f43ba74305de456c9cafa412123d6935aad7a998
--- /dev/null
+++ b/libc/glibc/sysdeps/arm/sysdep.h
@@ -0,0 +1,339 @@
+/* Assembler macros for ARM.
+ Copyright (C) 1997-2019 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
+ . */
+
+#include
+#include
+
+#ifndef __ASSEMBLER__
+# include
+#else
+# include
+#endif
+
+/* The __ARM_ARCH define is provided by gcc 4.8. Construct it otherwise. */
+#ifndef __ARM_ARCH
+# ifdef __ARM_ARCH_2__
+# define __ARM_ARCH 2
+# elif defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
+# define __ARM_ARCH 3
+# elif defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__)
+# define __ARM_ARCH 4
+# elif defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5E__) \
+ || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+# define __ARM_ARCH 5
+# elif defined (__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+ || defined (__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
+ || defined (__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__)
+# define __ARM_ARCH 6
+# elif defined (__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+ || defined(__ARM_ARCH_7EM__)
+# define __ARM_ARCH 7
+# else
+# error unknown arm architecture
+# endif
+#endif
+
+#if __ARM_ARCH > 4 || defined (__ARM_ARCH_4T__)
+# define ARCH_HAS_BX
+#endif
+#if __ARM_ARCH > 4
+# define ARCH_HAS_BLX
+#endif
+#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
+# define ARCH_HAS_HARD_TP
+#endif
+#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6T2__)
+# define ARCH_HAS_T2
+#endif
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+#define ALIGNARG(log2) log2
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+#define PLTJMP(_x) _x##(PLT)
+
+#ifdef ARCH_HAS_BX
+# define BX(R) bx R
+# define BXC(C, R) bx##C R
+# ifdef ARCH_HAS_BLX
+# define BLX(R) blx R
+# else
+# define BLX(R) mov lr, pc; bx R
+# endif
+#else
+# define BX(R) mov pc, R
+# define BXC(C, R) mov##C pc, R
+# define BLX(R) mov lr, pc; mov pc, R
+#endif
+
+#define DO_RET(R) BX(R)
+#define RETINSTR(C, R) BXC(C, R)
+
+/* Define an entry point visible from C. */
+#define ENTRY(name) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),%function; \
+ .align ALIGNARG(4); \
+ C_LABEL(name) \
+ CFI_SECTIONS; \
+ cfi_startproc; \
+ CALL_MCOUNT
+
+#define CFI_SECTIONS \
+ .cfi_sections .debug_frame
+
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ ASM_SIZE_DIRECTIVE(name)
+
+/* If compiled for profiling, call `mcount' at the start of each function. */
+#ifdef PROF
+/* Call __gnu_mcount_nc (GCC >= 4.4). */
+#define CALL_MCOUNT \
+ push {lr}; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (lr, 0); \
+ bl PLTJMP(mcount); \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (lr)
+#else
+#define CALL_MCOUNT /* Do nothing. */
+#endif
+
+/* Since C identifiers are not normally prefixed with an underscore
+ on this system, the asm identifier `syscall_error' intrudes on the
+ C name space. Make sure we use an innocuous name. */
+#define syscall_error __syscall_error
+#define mcount __gnu_mcount_nc
+
+/* Tag_ABI_align8_preserved: This code preserves 8-byte
+ alignment in any callee. */
+ .eabi_attribute 25, 1
+/* Tag_ABI_align8_needed: This code may require 8-byte alignment from
+ the caller. */
+ .eabi_attribute 24, 1
+
+/* The thumb2 encoding is reasonably complete. Unless suppressed, use it. */
+ .syntax unified
+# if defined(__thumb2__) && !defined(NO_THUMB)
+ .thumb
+#else
+# undef __thumb__
+# undef __thumb2__
+ .arm
+# endif
+
+/* Load or store to/from address X + Y into/from R, (maybe) using T.
+ X or Y can use T freely; T can be R if OP is a load. The first
+ version eschews the two-register addressing mode, while the
+ second version uses it. */
+# define LDST_INDEXED_NOINDEX(OP, R, T, X, Y) \
+ add T, X, Y; \
+ OP R, [T]
+# define LDST_INDEXED_INDEX(OP, R, X, Y) \
+ OP R, [X, Y]
+
+# ifdef ARM_NO_INDEX_REGISTER
+/* We're never using the two-register addressing mode, so this
+ always uses an intermediate add. */
+# define LDST_INDEXED(OP, R, T, X, Y) LDST_INDEXED_NOINDEX (OP, R, T, X, Y)
+# define LDST_PC_INDEXED(OP, R, T, X) LDST_INDEXED_NOINDEX (OP, R, T, pc, X)
+# else
+/* The two-register addressing mode is OK, except on Thumb with pc. */
+# define LDST_INDEXED(OP, R, T, X, Y) LDST_INDEXED_INDEX (OP, R, X, Y)
+# ifdef __thumb2__
+# define LDST_PC_INDEXED(OP, R, T, X) LDST_INDEXED_NOINDEX (OP, R, T, pc, X)
+# else
+# define LDST_PC_INDEXED(OP, R, T, X) LDST_INDEXED_INDEX (OP, R, pc, X)
+# endif
+# endif
+
+/* Load or store to/from a pc-relative EXPR into/from R, using T. */
+# ifdef __thumb2__
+# define LDST_PCREL(OP, R, T, EXPR) \
+ ldr T, 98f; \
+ .subsection 2; \
+98: .word EXPR - 99f - PC_OFS; \
+ .previous; \
+99: add T, T, pc; \
+ OP R, [T]
+# elif defined (ARCH_HAS_T2) && ARM_PCREL_MOVW_OK
+# define LDST_PCREL(OP, R, T, EXPR) \
+ movw T, #:lower16:EXPR - 99f - PC_OFS; \
+ movt T, #:upper16:EXPR - 99f - PC_OFS; \
+99: LDST_PC_INDEXED (OP, R, T, T)
+# else
+# define LDST_PCREL(OP, R, T, EXPR) \
+ ldr T, 98f; \
+ .subsection 2; \
+98: .word EXPR - 99f - PC_OFS; \
+ .previous; \
+99: OP R, [pc, T]
+# endif
+
+/* Load from a global SYMBOL + CONSTANT into R, using T. */
+# if defined (ARCH_HAS_T2) && !defined (PIC)
+# define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \
+ movw T, #:lower16:SYMBOL; \
+ movt T, #:upper16:SYMBOL; \
+ ldr R, [T, $CONSTANT]
+# elif defined (ARCH_HAS_T2) && defined (PIC) && ARM_PCREL_MOVW_OK
+# define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \
+ movw R, #:lower16:_GLOBAL_OFFSET_TABLE_ - 97f - PC_OFS; \
+ movw T, #:lower16:99f - 98f - PC_OFS; \
+ movt R, #:upper16:_GLOBAL_OFFSET_TABLE_ - 97f - PC_OFS; \
+ movt T, #:upper16:99f - 98f - PC_OFS; \
+ .pushsection .rodata.cst4, "aM", %progbits, 4; \
+ .balign 4; \
+99: .word SYMBOL##(GOT); \
+ .popsection; \
+97: add R, R, pc; \
+98: LDST_PC_INDEXED (ldr, T, T, T); \
+ LDST_INDEXED (ldr, R, T, R, T); \
+ ldr R, [R, $CONSTANT]
+# else
+# define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \
+ ldr T, 99f; \
+ ldr R, 100f; \
+98: add T, T, pc; \
+ ldr T, [T, R]; \
+ .subsection 2; \
+99: .word _GLOBAL_OFFSET_TABLE_ - 98b - PC_OFS; \
+100: .word SYMBOL##(GOT); \
+ .previous; \
+ ldr R, [T, $CONSTANT]
+# endif
+
+/* This is the same as LDR_GLOBAL, but for a SYMBOL that is known to
+ be in the same linked object (as for one with hidden visibility).
+ We can avoid the GOT indirection in the PIC case. For the pure
+ static case, LDR_GLOBAL is already optimal. */
+# ifdef PIC
+# define LDR_HIDDEN(R, T, SYMBOL, CONSTANT) \
+ LDST_PCREL (ldr, R, T, SYMBOL + CONSTANT)
+# else
+# define LDR_HIDDEN(R, T, SYMBOL, CONSTANT) \
+ LDR_GLOBAL (R, T, SYMBOL, CONSTANT)
+# endif
+
+/* Cope with negative memory offsets, which thumb can't encode.
+ Use NEGOFF_ADJ_BASE to (conditionally) alter the base register,
+ and then NEGOFF_OFF1 to use 0 for thumb and the offset for arm,
+ or NEGOFF_OFF2 to use A-B for thumb and A for arm. */
+# ifdef __thumb2__
+# define NEGOFF_ADJ_BASE(R, OFF) add R, R, $OFF
+# define NEGOFF_ADJ_BASE2(D, S, OFF) add D, S, $OFF
+# define NEGOFF_OFF1(R, OFF) [R]
+# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $((OFFA) - (OFFB))]
+# else
+# define NEGOFF_ADJ_BASE(R, OFF)
+# define NEGOFF_ADJ_BASE2(D, S, OFF) mov D, S
+# define NEGOFF_OFF1(R, OFF) [R, $OFF]
+# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $OFFA]
+# endif
+
+/* Helper to get the TLS base pointer. The interface is that TMP is a
+ register that may be used to hold the LR, if necessary. TMP may be
+ LR itself to indicate that LR need not be saved. The base pointer
+ is returned in R0. Only R0 and TMP are modified. */
+
+# ifdef ARCH_HAS_HARD_TP
+/* If the cpu has cp15 available, use it. */
+# define GET_TLS(TMP) mrc p15, 0, r0, c13, c0, 3
+# else
+/* At this generic level we have no tricks to pull. Call the ABI routine. */
+# define GET_TLS(TMP) \
+ push { r1, r2, r3, lr }; \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (16); \
+ cfi_rel_offset (r1, 0); \
+ cfi_rel_offset (r2, 4); \
+ cfi_rel_offset (r3, 8); \
+ cfi_rel_offset (lr, 12); \
+ bl __aeabi_read_tp; \
+ pop { r1, r2, r3, lr }; \
+ cfi_restore_state
+# endif /* ARCH_HAS_HARD_TP */
+
+/* These are the directives used for EABI unwind info.
+ Wrap them in macros so another configuration's sysdep.h
+ file can define them away if it doesn't use EABI unwind info. */
+# define eabi_fnstart .fnstart
+# define eabi_fnend .fnend
+# define eabi_save(...) .save __VA_ARGS__
+# define eabi_cantunwind .cantunwind
+# define eabi_pad(n) .pad n
+
+#endif /* __ASSEMBLER__ */
+
+/* This number is the offset from the pc at the current location. */
+#ifdef __thumb__
+# define PC_OFS 4
+#else
+# define PC_OFS 8
+#endif
+
+/* Pointer mangling support. */
+#if (IS_IN (rtld) || \
+ (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread))))
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE_LOAD(guard, tmp) \
+ LDR_HIDDEN (guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local), 0)
+# define PTR_MANGLE(dst, src, guard, tmp) \
+ PTR_MANGLE_LOAD(guard, tmp); \
+ PTR_MANGLE2(dst, src, guard)
+/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
+# define PTR_MANGLE2(dst, src, guard) \
+ eor dst, src, guard
+# define PTR_DEMANGLE(dst, src, guard, tmp) \
+ PTR_MANGLE (dst, src, guard, tmp)
+# define PTR_DEMANGLE2(dst, src, guard) \
+ PTR_MANGLE2 (dst, src, guard)
+# else
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
+#else
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE_LOAD(guard, tmp) \
+ LDR_GLOBAL (guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard), 0);
+# define PTR_MANGLE(dst, src, guard, tmp) \
+ PTR_MANGLE_LOAD(guard, tmp); \
+ PTR_MANGLE2(dst, src, guard)
+/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
+# define PTR_MANGLE2(dst, src, guard) \
+ eor dst, src, guard
+# define PTR_DEMANGLE(dst, src, guard, tmp) \
+ PTR_MANGLE (dst, src, guard, tmp)
+# define PTR_DEMANGLE2(dst, src, guard) \
+ PTR_MANGLE2 (dst, src, guard)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
+#endif
diff --git a/libc/glibc/sysdeps/csky/abiv2/start.S b/libc/glibc/sysdeps/csky/abiv2/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..324ed69d322cf2fbc4a6c0b3db35bc66c425a82d
--- /dev/null
+++ b/libc/glibc/sysdeps/csky/abiv2/start.S
@@ -0,0 +1,108 @@
+/* Startup code compliant to the ELF C-SKY ABIV2.
+ Copyright (C) 2018-2019 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.
+
+ 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
+ . */
+
+/* We need to call:
+ __libc_start_main (int (*main) (int, char **, char **), int argc,
+ char **argv, void (*init) (void), void (*fini) (void),
+ void (*rtld_fini) (void), void *stack_end)
+ */
+
+#include
+
+ .text
+ .globl _start;
+ .type _start,@function;
+ .align 4;
+_start:
+ subi sp, 8
+ /* Clear the link register since this is the outermost frame. */
+ movi lr, 0
+ /* Pop argc off the stack and save a pointer to argv. */
+ ldw a1, (sp, 8) /* Init argc for __libc_start_main. */
+ addi a2, sp, 12 /* Init argv for __libc_start_main. */
+
+ /* Push stack limit. */
+ stw a2, (sp, 8)
+ /* Push rtld_fini. */
+ stw a0, (sp, 4)
+
+#ifdef SHARED
+ grs t0, .Lgetpc
+.Lgetpc:
+ lrw gb, .Lgetpc@GOTPC
+ addu gb, t0
+ lrw a3, __libc_csu_fini@GOT
+ ldr.w a3, (gb, a3 << 0)
+ stw a3, (sp, 0)
+
+ lrw a3, __libc_csu_init@GOT
+ addu a3, gb
+ ldw a3, (a3, 0)
+
+ lrw t0, main@GOT
+ addu t0, gb
+ ldw a0, (t0, 0)
+ lrw t1, __libc_start_main@PLT
+ ldr.w t1, (gb, t1 << 0)
+ jsr t1
+
+ lrw t1, abort@PLT
+ ldr.w t1, (gb, t1 << 0)
+ jsr t1
+#else
+ /* Fetch address of __libc_csu_fini. */
+ lrw a0, __libc_csu_fini
+ /* Push __libc_csu_fini */
+ stw a0, (sp, 0)
+
+ /* Set up the other arguments in registers. */
+ lrw a0, main
+ lrw a3, __libc_csu_init
+ /* Let the libc call main and exit with its return code. */
+ jsri __libc_start_main
+
+ /* Should never get here. */
+ jsri abort
+#endif /* !SHARED */
+ .size _start,.-_start
+
+
+ /* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/csky/bits/endian.h b/libc/glibc/sysdeps/csky/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..51df38d8f91b551918b618125b406cc9adba1ca3
--- /dev/null
+++ b/libc/glibc/sysdeps/csky/bits/endian.h
@@ -0,0 +1,9 @@
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#ifdef __CSKYBE__
+# error "Big endian not supported for C-SKY."
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/libc/glibc/sysdeps/csky/dl-sysdep.h b/libc/glibc/sysdeps/csky/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..66df46308d58561abcffedb51c2bb8f820c2a675
--- /dev/null
+++ b/libc/glibc/sysdeps/csky/dl-sysdep.h
@@ -0,0 +1,23 @@
+/* System-specific settings for dynamic linker code. C-SKY version.
+ Copyright (C) 2018-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
diff --git a/libc/glibc/sysdeps/csky/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/csky/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a49114eacc4775d65efd446a8add34521f5309b
--- /dev/null
+++ b/libc/glibc/sysdeps/csky/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,70 @@
+/* Machine-specific pthread type layouts. C-SKY version.
+ Copyright (C) 2018-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 32
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
+#define __PTHREAD_MUTEX_USE_UNION 1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+/* Paddings in this structure are not strictly necessary on C-SKY.
+ They are left for extensibility as most other architecture do so. */
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ unsigned char __flags;
+#else
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif
diff --git a/libc/glibc/sysdeps/csky/sysdep.h b/libc/glibc/sysdeps/csky/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..984245d2ccbbbf385edd8999b48ecc256f5dcec2
--- /dev/null
+++ b/libc/glibc/sysdeps/csky/sysdep.h
@@ -0,0 +1,84 @@
+/* Assembler macros for C-SKY.
+ Copyright (C) 2018-2019 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
+ . */
+
+#include
+#include
+
+#ifdef __ASSEMBLER__
+
+# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+/* Define an entry point visible from C. */
+# define ENTRY(name) \
+ .globl name; \
+ .type name,@function; \
+ .align 4; \
+ name##:; \
+ cfi_startproc; \
+ CALL_MCOUNT
+
+# undef END
+# define END(name) \
+ cfi_endproc; \
+ ASM_SIZE_DIRECTIVE(name)
+
+/* If compiled for profiling, call `mcount' at the start of each function. */
+# ifdef PROF
+# ifdef __PIC__
+# define CALL_MCOUNT \
+ subi sp, 4; \
+ stw lr, (sp, 0); \
+ grs t0, .Lgetpc; \
+.Lgetpc: \
+ lrw gb, .Lgetpc@GOTPC; \
+ addu gb, t0; \
+ lrw t1, _mcount@PLT; \
+ ldr.w t0, (gb, t1 << 0); \
+ jmp t0;
+# else
+# define CALL_MCOUNT \
+ subi sp, 4; \
+ stw lr, (sp, 0); \
+ jbsr _mcount;
+# endif
+# else
+# define CALL_MCOUNT /* Do nothing. */
+# endif
+
+# if defined (__CK860__)
+/* Instruction fetch will be faster when the label is 16 bytes aligned.
+ Filling with nop instruction to avoid extra jump. */
+# define LABLE_ALIGN \
+ .balignw 16, 0x6c03
+
+# define PRE_BNEZAD(R)
+
+# define BNEZAD(R, L) \
+ bnezad R, L
+# else
+# define LABLE_ALIGN \
+ .balignw 8, 0x6c03
+
+# define PRE_BNEZAD(R) \
+ subi R, 1
+
+# define BNEZAD(R, L) \
+ bnez R, L
+# endif
+
+#endif
diff --git a/libc/glibc/sysdeps/generic/allocalim.h b/libc/glibc/sysdeps/generic/allocalim.h
deleted file mode 100644
index 2491129a7dba3b94bc376828ec3a0d34c1eb16a7..0000000000000000000000000000000000000000
--- a/libc/glibc/sysdeps/generic/allocalim.h
+++ /dev/null
@@ -1,4 +0,0 @@
-extern inline int __libc_use_alloca (size_t size)
-{
- return size <= __MAX_ALLOCA_CUTOFF;
-}
diff --git a/libc/glibc/sysdeps/generic/dl-sysdep.h b/libc/glibc/sysdeps/generic/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..34fbffe22ddefd353071869ed4bb18105b1e906f
--- /dev/null
+++ b/libc/glibc/sysdeps/generic/dl-sysdep.h
@@ -0,0 +1,34 @@
+/* System-specific settings for dynamic linker code. Generic version.
+ Copyright (C) 2002-2019 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
+ . */
+
+/* No multiple inclusion protection need here because it's just macros.
+ We don't want to use _DL_SYSDEP_H in case we are #include_next'd. */
+
+/* This macro must be defined to either 0 or 1.
+
+ If 1, then an errno global variable hidden in ld.so will work right with
+ all the errno-using libc code compiled for ld.so, and there is never a
+ need to share the errno location with libc. This is appropriate only if
+ all the libc functions that ld.so uses are called without PLT and always
+ get the versions linked into ld.so rather than the libc ones. */
+
+#if IS_IN (rtld)
+# define RTLD_PRIVATE_ERRNO 1
+#else
+# define RTLD_PRIVATE_ERRNO 0
+#endif
diff --git a/libc/glibc/sysdeps/generic/stackinfo.h b/libc/glibc/sysdeps/generic/stackinfo.h
deleted file mode 100644
index 7a6c3e457b6622353b8b77faa699dda796659173..0000000000000000000000000000000000000000
--- a/libc/glibc/sysdeps/generic/stackinfo.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 1999-2019 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
- . */
-
-/* This file contains a bit of information about the stack allocation
- of the processor. Since there is no general truth we can't say
- anything here. */
diff --git a/libc/glibc/sysdeps/generic/sys/syscall.h b/libc/glibc/sysdeps/generic/sys/syscall.h
new file mode 100644
index 0000000000000000000000000000000000000000..719bd08904d04ae0ce38403a440bf8ed1bd74e2c
--- /dev/null
+++ b/libc/glibc/sysdeps/generic/sys/syscall.h
@@ -0,0 +1,2 @@
+/* For Unix-like systems, this file should contain definitions
+ of macros SYS_call for each system call, giving the call numbers. */
diff --git a/libc/glibc/sysdeps/generic/tls.h b/libc/glibc/sysdeps/generic/tls.h
new file mode 100644
index 0000000000000000000000000000000000000000..270adef3e15b458fc5c5ed9951395c7f1cfc254f
--- /dev/null
+++ b/libc/glibc/sysdeps/generic/tls.h
@@ -0,0 +1,80 @@
+/* Definition for thread-local data handling. Generic version.
+ Copyright (C) 2002-2019 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
+ . */
+
+/* An architecture-specific version of this file has to defined a
+ number of symbols:
+
+ TLS_TCB_AT_TP or TLS_DTV_AT_TP
+
+ The presence of one of these symbols signals which variant of
+ the TLS ABI is used. There are in the moment two variants
+ available:
+
+ * the thread pointer points to a thread control block
+
+ * the thread pointer points to the dynamic thread vector
+
+
+ TLS_TCB_SIZE
+
+ This is the size of the thread control block structure. How
+ this is actually defined depends on the ABI. The thread control
+ block could be internal descriptor of the thread library or
+ just a data structure which allows finding the DTV.
+
+ TLS_INIT_TCB_SIZE
+
+ Similarly, but this value is only used at startup and in the
+ dynamic linker itself. There are no threads in use at that time.
+
+
+ TLS_TCB_ALIGN
+
+ Alignment requirements for the TCB structure.
+
+ TLS_INIT_TCB_ALIGN
+
+ Similarly, but for the structure used at startup time.
+
+
+ INSTALL_DTV(tcb, init_dtv)
+
+ This macro must install the given initial DTV into the thread control
+ block TCB. The normal runtime functionality must then be able to
+ use the value.
+
+
+ TLS_INIT_TP(tcb)
+
+ This macro must initialize the thread pointer to enable normal TLS
+ operation. The parameter is a pointer to the thread control block.
+ ld.so calls this macro once.
+
+
+ THREAD_DTV()
+
+ This macro returns the address of the DTV of the current thread.
+ This normally is done using the thread register which points
+ to the dtv or the TCB (from which the DTV can found).
+
+
+ THREAD_GSCOPE_IN_TCB
+
+ This should be set to 1 if the global scope flag is stored within the TCB.
+ When set to 0, GL(_dl_thread_gscope_count) will be defined to store it.
+ */
diff --git a/libc/glibc/sysdeps/hppa/bits/endian.h b/libc/glibc/sysdeps/hppa/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..585db0c0faade91ad57f9e6de2e419ab91653481
--- /dev/null
+++ b/libc/glibc/sysdeps/hppa/bits/endian.h
@@ -0,0 +1,7 @@
+/* hppa1.1 big-endian. */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/libc/glibc/sysdeps/hppa/crti.S b/libc/glibc/sysdeps/hppa/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..8daa5865b395598664db1f56532ed428c459ab2b
--- /dev/null
+++ b/libc/glibc/sysdeps/hppa/crti.S
@@ -0,0 +1,162 @@
+/* Special .init and .fini section support for HPPA
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+
+/* If we have working .init_array support, we want to keep the .init
+ section empty (apart from the mandatory prologue/epilogue. This
+ ensures that the default unwind conventions (return-pointer in b0,
+ frame state in ar.pfs, etc.) will do the Right Thing. To ensure
+ an empty .init section, we register gmon_initializer() via the
+ .init_array.
+
+ --davidm 02/10/29 */
+
+#if PREINIT_FUNCTION_WEAK
+/* This blob of assembly code is one simple C function:
+
+static void
+__attribute__ ((used))
+gmon_initializer (void)
+{
+ extern void weak_function __gmon_start__ (void);
+
+ if (__gmon_start__)
+ (*__gmon_start__)();
+}
+
+In a final executable, PLABEL32 relocations for function pointers are
+resolved at link time. Typically, binutils/ld resolves __gmon_start__
+using an external shared library. __gmon_start__ is always called if
+it is found at link time. If __gmon_start__ is not found at runtime
+due to a library update, then the function pointer will point at a null
+function descriptor and calling it will cause a segmentation fault.
+So, we call __canonicalize_funcptr_for_compare to obtain the canonicalized
+address of __gmon_start__ and skip calling __gmon_start__ if it is zero.
+
+ */
+ .type __canonicalize_funcptr_for_compare,@function
+ .type $$dyncall,@function
+
+ .section .data.rel.ro,"aw",@progbits
+ .align 4
+.LC0:
+ .type __gmon_start__,@function
+ .word P%__gmon_start__
+
+ .text
+ .align 4
+ .type gmon_initializer,@function
+gmon_initializer:
+ .PROC
+ .CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=4
+ .ENTRY
+ stw %r2,-20(%r30)
+ stwm %r4,64(%r30)
+ stw %r3,-60(%r30)
+ addil LT'.LC0,%r19
+ ldw RT'.LC0(%r1),%r28
+ ldw 0(%r28),%r3
+ comib,= 0,%r3,1f
+ copy %r19,%r4
+ stw %r19,-32(%r30)
+ bl __canonicalize_funcptr_for_compare,%r2
+ copy %r3,%r26
+ comib,= 0,%r28,1f
+ copy %r4,%r19
+ copy %r3,%r22
+ .CALL ARGW0=GR
+ bl $$dyncall,%r31
+ copy %r31,%r2
+1:
+ ldw -84(%r30),%r2
+ ldw -60(%r30),%r3
+ bv %r0(%r2)
+ ldwm -64(%r30),%r4
+ .EXIT
+ .PROCEND
+ .size gmon_initializer, .-gmon_initializer
+
+# undef PREINIT_FUNCTION
+# define PREINIT_FUNCTION gmon_initializer
+#endif
+
+ .section .init_array, "aw"
+ .word P% PREINIT_FUNCTION
+
+
+/* _init prologue. */
+ .section .init, "ax", %progbits
+ .align 4
+ .globl _init
+ .hidden _init
+ .type _init,@function
+_init:
+ stw %rp,-20(%sp)
+ stwm %r4,64(%sp)
+ stw %r19,-32(%sp)
+
+/* _fini prologue. */
+ .section .fini,"ax",%progbits
+ .align 4
+ .globl _fini
+ .hidden _fini
+ .type _fini,@function
+_fini:
+ stw %rp,-20(%sp)
+ stwm %r4,64(%sp)
+ stw %r19,-32(%sp)
+ copy %r19,%r4
diff --git a/libc/glibc/sysdeps/hppa/crtn.S b/libc/glibc/sysdeps/hppa/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..ad00a5285f50f2a36e00816be55bb0f0cc75ae47
--- /dev/null
+++ b/libc/glibc/sysdeps/hppa/crtn.S
@@ -0,0 +1,66 @@
+/* Special .init and .fini section support for HPPA
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+#include
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init, "ax", @progbits
+ ldw -84(%sp),%rp
+ copy %r4,%r19
+ bv %r0(%rp)
+_end_init:
+ ldwm -64(%sp),%r4
+
+/* Our very own unwind info, because the assembler can't handle
+ functions split into two or more pieces. */
+ .section .PARISC.unwind
+ .extern _init
+ .word _init, _end_init
+ .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
+
+/* Here is the tail end of _fini. */
+ .section .fini, "ax", @progbits
+ ldw -84(%sp),%rp
+ copy %r4,%r19
+ bv %r0(%rp)
+_end_fini:
+ ldwm -64(%sp),%r4
+
+ .section .PARISC.unwind
+ .extern _fini
+ .word _fini, _end_fini
+ .byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
diff --git a/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..5d74f631872e960473212d3c82df67738e4b6c7e
--- /dev/null
+++ b/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,91 @@
+/* Copyright (C) 2005-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+/* Linuxthread type sizes (bytes):
+ sizeof(pthread_attr_t) = 0x24 (36)
+ sizeof(pthread_barrier_t) = 0x30 (48)
+ sizeof(pthread_barrierattr_t) = 0x4 (4)
+ sizeof(pthread_cond_t) = 0x30 (48)
+ sizeof(pthread_condattr_t) = 0x4 (4)
+ sizeof(pthread_mutex_t) = 0x30 (48)
+ sizeof(pthread_mutexattr_t) = 0x4 (4)
+ sizeof(pthread_rwlock_t) = 0x40 (64)
+ sizeof(pthread_rwlockattr_t) = 0x8 (8)
+ sizeof(pthread_spinlock_t) = 0x10 (16) */
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 48
+#define __SIZEOF_PTHREAD_BARRIER_T 48
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 64
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+
+/* The old 4-word 16-byte aligned lock. This is initalized
+ to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
+ Unused in NPTL. */
+#define __PTHREAD_COMPAT_PADDING_MID int __compat_padding[4];
+/* Two more words are left before the NPTL
+ pthread_mutex_t is larger than Linuxthreads. */
+#define __PTHREAD_COMPAT_PADDING_END int __reserved[2];
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
+#define __PTHREAD_MUTEX_USE_UNION 1
+
+#define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ /* In the old Linuxthreads pthread_rwlock_t, this is the
+ start of the 4-word 16-byte aligned lock structure. The
+ next four words are all set to 1 by the Linuxthreads
+ PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL. */
+ int __compat_padding[4] __attribute__ ((__aligned__(16)));
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ int __cur_writer;
+ /* An unused word, reserved for future use. It was added
+ to maintain the location of the flags from the Linuxthreads
+ layout of this structure. */
+ int __reserved1;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __pad2;
+ unsigned char __pad1;
+ unsigned char __shared;
+ unsigned char __flags;
+ /* The NPTL pthread_rwlock_t is 4 words smaller than the
+ Linuxthreads version. One word is in the middle of the
+ structure, the other three are at the end. */
+ int __reserved2;
+ int __reserved3;
+ int __reserved4;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/hppa/start.S b/libc/glibc/sysdeps/hppa/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..00c84494fc2fe02c16aef4c6db1139378c693047
--- /dev/null
+++ b/libc/glibc/sysdeps/hppa/start.S
@@ -0,0 +1,152 @@
+/* ELF startup code for HPPA.
+ Copyright (C) 2002-2019 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.
+
+ 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
+ . */
+
+ .import main, code
+ .import $global$, data
+ .import __libc_start_main, code
+ .import __libc_csu_fini, code
+ .import __libc_csu_init, code
+
+ /* Have the linker create plabel words so we get PLABEL32
+ relocs and not 21/14. The use of 21/14 relocs is only
+ supported in the latest dynamic linker. */
+#ifdef PIC
+ .section .data.rel.ro,"aw",@progbits
+#else
+ .section .rodata,"a",@progbits
+#endif
+ .align 4
+.Lpmain:
+ .word P%main
+.Lp__libc_start_main:
+ .word P%__libc_start_main
+.Lp__libc_csu_fini:
+ .word P%__libc_csu_fini
+.Lp__libc_csu_init:
+ .word P%__libc_csu_init
+
+ .text
+ .align 4
+ .globl _start
+ .export _start, ENTRY
+ .type _start,@function
+_start:
+ /* At entry to the function we have:
+
+ r26 - Unused
+ r25 - argc
+ r24 - argv
+ r23 - False _dl_fini plabel address
+
+ This function is called from the lower half of RTLD_START.
+
+ The call to __libc_start_main expects:
+
+ 1. r26 - Application main
+ 2. r25 - argc
+ 3. r24 - argv
+ 4. r23 - __libc_csu_init
+ 5. sp-52 - __libc_csu_fini
+ 6. sp-56 - rtld_fini
+ 7. sp-60 - stackend */
+
+ .proc
+ .callinfo
+ /* Clear previous-sp. */
+ stw %r0, -4(%sp)
+ /* Setup the stack and frame. */
+ stw %rp, -20(%sp)
+ ldo 64(%sp), %sp
+ stw %sp, -4(%sp)
+ stw %r19, -32(%sp)
+
+ /* argc and argv should be in 25 and 24 (2nd and 3rd argument) */
+ /* void (*rtld_fini) (void) (6th argument) */
+ stw %r23, -56(%sp)
+
+ /* Need to setup 1, 4, 5, and 7th arguments */
+
+#ifdef PIC
+ /* Load $global$ address into %dp */
+ bl .+8, %dp
+ addil L'$global$-$PIC_pcrel$0+1, %dp
+ ldo R'$global$-$PIC_pcrel$0+5(%r1), %dp
+
+ /* load main (1st argument) */
+ addil LT'.Lpmain, %r19
+ ldw RT'.Lpmain(%r1), %r26
+ ldw 0(%r26),%r26
+ /* void (*init) (void) (4th argument) */
+ addil LT'.Lp__libc_csu_init, %r19
+ ldw RT'.Lp__libc_csu_init(%r1), %r23
+ ldw 0(%r23), %r23
+ /* void (*fini) (void) (5th argument) */
+ addil LT'.Lp__libc_csu_fini, %r19
+ ldw RT'.Lp__libc_csu_fini(%r1), %r22
+ ldw 0(%r22), %r22
+#else
+ /* Load $global$ address into %dp */
+ ldil L%$global$, %dp
+ ldo R%$global$(%dp), %dp
+
+ /* load main (1st argument) */
+ ldil LR'.Lpmain, %r26
+ ldw RR'.Lpmain(%r26), %r26
+ /* void (*init) (void) (4th argument) */
+ ldil LR'.Lp__libc_csu_init, %r23
+ ldw RR'.Lp__libc_csu_init(%r23), %r23
+ /* void (*fini) (void) (5th argument) */
+ ldil LR'.Lp__libc_csu_fini, %r22
+ ldw RR'.Lp__libc_csu_fini(%r22), %r22
+#endif
+ /* Store 5th argument */
+ stw %r22, -52(%sp)
+ /* void *stack_end (7th argument) */
+ stw %sp, -60(%sp)
+ bl __libc_start_main,%r2
+ nop
+ /* die horribly if it returned (it shouldn't) */
+ iitlbp %r0,(%sr0,%r0)
+ nop
+
+ .procend
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/hppa/sysdep.h b/libc/glibc/sysdeps/hppa/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..a38a921f4fe1a729315c0de91cadbfe313fc0c7b
--- /dev/null
+++ b/libc/glibc/sysdeps/hppa/sysdep.h
@@ -0,0 +1,74 @@
+/* Assembler macros for HP/PA.
+ Copyright (C) 1999-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper, , August 1999.
+
+ 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
+ . */
+
+#include
+
+#undef ASM_LINE_SEP
+#define ASM_LINE_SEP !
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+#define ALIGNARG(log2) log2
+
+
+/* Define an entry point visible from C.
+
+ There is currently a bug in gdb which prevents us from specifying
+ incomplete stabs information. Fake some entries here which specify
+ the current source file. */
+#define ENTRY(name) \
+ .SPACE $TEXT$ ASM_LINE_SEP \
+ .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
+ .align ALIGNARG(4) ASM_LINE_SEP \
+ .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
+ .EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR ASM_LINE_SEP\
+ C_LABEL(name) \
+ CALL_MCOUNT
+
+#undef END
+#define END(name) \
+ .PROCEND
+
+/* GCC does everything for us. */
+#ifdef PROF
+#define CALL_MCOUNT
+#else
+#define CALL_MCOUNT /* Do nothing. */
+#endif
+
+#define PSEUDO(name, syscall_name, args) \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args)
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) \
+ END (name)
+
+#undef JUMPTARGET
+#define JUMPTARGET(name) name
+#define SYSCALL_PIC_SETUP /* Nothing. */
+
+/* Local label name for asm code. */
+#ifndef L
+#define L(name) name
+#endif
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/htl/bits/pthread.h b/libc/glibc/sysdeps/htl/bits/pthread.h
new file mode 100644
index 0000000000000000000000000000000000000000..5ecb634d1c04a748d02e639e86ed71692f16f8cd
--- /dev/null
+++ b/libc/glibc/sysdeps/htl/bits/pthread.h
@@ -0,0 +1,36 @@
+/* Pthread data structures. Generic version.
+ Copyright (C) 2002-2019 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
+ . */
+
+#ifndef _BITS_PTHREAD_H
+#define _BITS_PTHREAD_H 1
+
+typedef int __pthread_t;
+
+/* Return true if __T1 and __T2 both name the same thread. Otherwise,
+ false. */
+extern int __pthread_equal (__pthread_t __t1, __pthread_t __t2);
+
+#ifdef __USE_EXTERN_INLINES
+__extern_inline int
+__pthread_equal (__pthread_t __t1, __pthread_t __t2)
+{
+ return __t1 == __t2;
+}
+#endif
+
+#endif /* bits/pthread.h */
diff --git a/libc/glibc/sysdeps/htl/bits/thread-shared-types.h b/libc/glibc/sysdeps/htl/bits/thread-shared-types.h
new file mode 100644
index 0000000000000000000000000000000000000000..e5fa702f552e3b691f2c8abcdebe4585a8a30d98
--- /dev/null
+++ b/libc/glibc/sysdeps/htl/bits/thread-shared-types.h
@@ -0,0 +1,24 @@
+/* Common threading primitives definitions for both POSIX and C11.
+ Copyright (C) 2017-2019 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
+ . */
+
+#ifndef _THREAD_SHARED_TYPES_H
+#define _THREAD_SHARED_TYPES_H 1
+
+#include
+
+#endif /* _THREAD_SHARED_TYPES_H */
diff --git a/libc/glibc/sysdeps/htl/libc-lockP.h b/libc/glibc/sysdeps/htl/libc-lockP.h
new file mode 100644
index 0000000000000000000000000000000000000000..85d861026954b5f4bbb86699fac8452b4c537fa7
--- /dev/null
+++ b/libc/glibc/sysdeps/htl/libc-lockP.h
@@ -0,0 +1,180 @@
+/* Private libc-internal interface for mutex locks.
+ Copyright (C) 2015-2019 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; see the file COPYING.LIB. If
+ not, see . */
+
+#ifndef _BITS_LIBC_LOCKP_H
+#define _BITS_LIBC_LOCKP_H 1
+
+#include
+#include
+
+/* Type for key to thread-specific data. */
+typedef pthread_key_t __libc_key_t;
+
+/* If we check for a weakly referenced symbol and then perform a
+ normal jump to it te code generated for some platforms in case of
+ PIC is unnecessarily slow. What would happen is that the function
+ is first referenced as data and then it is called indirectly
+ through the PLT. We can make this a direct jump. */
+#ifdef __PIC__
+# define __libc_maybe_call(FUNC, ARGS, ELSE) \
+ (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \
+ _fn != NULL ? (*_fn) ARGS : ELSE; }))
+#else
+# define __libc_maybe_call(FUNC, ARGS, ELSE) \
+ (FUNC != NULL ? FUNC ARGS : ELSE)
+#endif
+
+/* Call thread functions through the function pointer table. */
+#if defined SHARED && IS_IN (libc)
+# define PTFAVAIL(NAME) __libc_pthread_functions_init
+# define __libc_ptf_call(FUNC, ARGS, ELSE) \
+ (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE)
+# define __libc_ptf_call_always(FUNC, ARGS) \
+ PTHFCT_CALL (ptr_##FUNC, ARGS)
+#elif IS_IN (libpthread)
+# define PTFAVAIL(NAME) 1
+# define __libc_ptf_call(FUNC, ARGS, ELSE) \
+ FUNC ARGS
+# define __libc_ptf_call_always(FUNC, ARGS) \
+ FUNC ARGS
+#else
+# define PTFAVAIL(NAME) (NAME != NULL)
+# define __libc_ptf_call(FUNC, ARGS, ELSE) \
+ __libc_maybe_call (FUNC, ARGS, ELSE)
+# define __libc_ptf_call_always(FUNC, ARGS) \
+ FUNC ARGS
+#endif
+
+/* Create thread-specific key. */
+#define __libc_key_create(KEY, DESTRUCTOR) \
+ __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1)
+
+/* Get thread-specific data. */
+#define __libc_getspecific(KEY) \
+ __libc_ptf_call (__pthread_getspecific, (KEY), NULL)
+
+/* Set thread-specific data. */
+#define __libc_setspecific(KEY, VALUE) \
+ __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0)
+
+
+/* Functions that are used by this file and are internal to the GNU C
+ library. */
+
+extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
+ const pthread_mutexattr_t *__mutex_attr);
+
+extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr);
+
+extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
+
+extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr,
+ int __kind);
+
+extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
+ const pthread_rwlockattr_t *__attr);
+
+extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_key_create (pthread_key_t *__key,
+ void (*__destr_function) (void *));
+
+extern int __pthread_setspecific (pthread_key_t __key,
+ const void *__pointer);
+
+extern void *__pthread_getspecific (pthread_key_t __key);
+
+extern int __pthread_once (pthread_once_t *__once_control,
+ void (*__init_routine) (void));
+
+extern int __pthread_atfork (void (*__prepare) (void),
+ void (*__parent) (void),
+ void (*__child) (void));
+
+
+
+/* Make the pthread functions weak so that we can elide them from
+ single-threaded processes. */
+#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
+# ifdef weak_extern
+weak_extern (__pthread_mutex_init)
+weak_extern (__pthread_mutex_destroy)
+weak_extern (__pthread_mutex_lock)
+weak_extern (__pthread_mutex_trylock)
+weak_extern (__pthread_mutex_unlock)
+weak_extern (__pthread_mutexattr_init)
+weak_extern (__pthread_mutexattr_destroy)
+weak_extern (__pthread_mutexattr_settype)
+weak_extern (__pthread_rwlock_init)
+weak_extern (__pthread_rwlock_destroy)
+weak_extern (__pthread_rwlock_rdlock)
+weak_extern (__pthread_rwlock_tryrdlock)
+weak_extern (__pthread_rwlock_wrlock)
+weak_extern (__pthread_rwlock_trywrlock)
+weak_extern (__pthread_rwlock_unlock)
+weak_extern (__pthread_key_create)
+weak_extern (__pthread_setspecific)
+weak_extern (__pthread_getspecific)
+weak_extern (__pthread_once)
+weak_extern (__pthread_initialize)
+weak_extern (__pthread_atfork)
+weak_extern (__pthread_setcancelstate)
+# else
+# pragma weak __pthread_mutex_init
+# pragma weak __pthread_mutex_destroy
+# pragma weak __pthread_mutex_lock
+# pragma weak __pthread_mutex_trylock
+# pragma weak __pthread_mutex_unlock
+# pragma weak __pthread_mutexattr_init
+# pragma weak __pthread_mutexattr_destroy
+# pragma weak __pthread_mutexattr_settype
+# pragma weak __pthread_rwlock_destroy
+# pragma weak __pthread_rwlock_rdlock
+# pragma weak __pthread_rwlock_tryrdlock
+# pragma weak __pthread_rwlock_wrlock
+# pragma weak __pthread_rwlock_trywrlock
+# pragma weak __pthread_rwlock_unlock
+# pragma weak __pthread_key_create
+# pragma weak __pthread_setspecific
+# pragma weak __pthread_getspecific
+# pragma weak __pthread_once
+# pragma weak __pthread_initialize
+# pragma weak __pthread_atfork
+# pragma weak __pthread_setcancelstate
+# endif
+#endif
+
+#endif /* bits/libc-lockP.h */
diff --git a/libc/glibc/sysdeps/htl/pthread.h b/libc/glibc/sysdeps/htl/pthread.h
new file mode 100644
index 0000000000000000000000000000000000000000..a8205519f2a4e0376c0f057ef07a42ebb0df297d
--- /dev/null
+++ b/libc/glibc/sysdeps/htl/pthread.h
@@ -0,0 +1,883 @@
+/* Posix threads. Hurd version.
+ Copyright (C) 2000-2019 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
+ . */
+
+/*
+ * POSIX Threads Extension: ???
+ */
+
+#ifndef _PTHREAD_H
+#define _PTHREAD_H 1
+
+#include
+
+#include
+#ifndef __extern_inline
+/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+ inline semantics, unless -fgnu89-inline is used. */
+# if !defined __cplusplus || __GNUC_PREREQ (4,3)
+# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
+# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
+# if __GNUC_PREREQ (4,3)
+# define __extern_always_inline \
+ extern __always_inline __attribute__ ((__gnu_inline__, __artificial__))
+# else
+# define __extern_always_inline \
+ extern __always_inline __attribute__ ((__gnu_inline__))
+# endif
+# else
+# define __extern_inline extern __inline
+# define __extern_always_inline extern __always_inline
+# endif
+# endif
+#endif
+
+#include
+#include
+
+__BEGIN_DECLS
+
+#include
+
+#include
+
+/* Possible values for the process shared attribute. */
+#define PTHREAD_PROCESS_PRIVATE __PTHREAD_PROCESS_PRIVATE
+#define PTHREAD_PROCESS_SHARED __PTHREAD_PROCESS_SHARED
+
+
+/* Thread attributes. */
+
+/* Possible values for the inheritsched attribute. */
+#define PTHREAD_EXPLICIT_SCHED __PTHREAD_EXPLICIT_SCHED
+#define PTHREAD_INHERIT_SCHED __PTHREAD_INHERIT_SCHED
+
+/* Possible values for the `contentionscope' attribute. */
+#define PTHREAD_SCOPE_SYSTEM __PTHREAD_SCOPE_SYSTEM
+#define PTHREAD_SCOPE_PROCESS __PTHREAD_SCOPE_PROCESS
+
+/* Possible values for the `detachstate' attribute. */
+#define PTHREAD_CREATE_JOINABLE __PTHREAD_CREATE_JOINABLE
+#define PTHREAD_CREATE_DETACHED __PTHREAD_CREATE_DETACHED
+
+#include
+
+/* Initialize the thread attribute object in *ATTR to the default
+ values. */
+extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
+
+/* Destroy the thread attribute object in *ATTR. */
+extern int pthread_attr_destroy (pthread_attr_t *__attr)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the inheritsched attribute in *ATTR in
+ *INHERITSCHED. */
+extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr,
+ int *__restrict __inheritsched)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the inheritsched attribute in *ATTR to
+ INHERITSCHED. */
+extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
+ int __inheritsched)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the schedparam attribute in *ATTR in *PARAM. */
+extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
+ struct sched_param *__restrict __param)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the schedparam attribute in *ATTR to PARAM. */
+extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
+ const struct sched_param *__restrict
+ __param) __THROW __nonnull ((1, 2));
+
+
+/* Return the value of the schedpolicy attribute in *ATTR to *POLICY. */
+extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict __attr,
+ int *__restrict __policy)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the schedpolicy attribute in *ATTR to POLICY. */
+extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr,
+ int __policy)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the contentionscope attribute in *ATTR in
+ *CONTENTIONSCOPE. */
+extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
+ int *__restrict __contentionscope)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the contentionscope attribute in *ATTR to
+ CONTENTIONSCOPE. */
+extern int pthread_attr_setscope (pthread_attr_t *__attr,
+ int __contentionscope)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the stackaddr attribute in *ATTR in
+ *STACKADDR. */
+extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr,
+ void **__restrict __stackaddr)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the stackaddr attribute in *ATTR to STACKADDR. */
+extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
+ void *__stackaddr)
+ __THROW __nonnull ((1));
+
+
+#ifdef __USE_XOPEN2K
+/* Return the value of the stackaddr and stacksize attributes in *ATTR
+ in *STACKADDR and *STACKSIZE respectively. */
+extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr,
+ void **__restrict __stackaddr,
+ size_t *__restrict __stacksize)
+ __THROW __nonnull ((1, 2, 3));
+
+/* Set the value of the stackaddr and stacksize attributes in *ATTR to
+ STACKADDR and STACKSIZE respectively. */
+extern int pthread_attr_setstack (pthread_attr_t *__attr,
+ void *__stackaddr,
+ size_t __stacksize)
+ __THROW __nonnull ((1));
+#endif
+
+
+/* Return the value of the detachstate attribute in *ATTR in
+ *DETACHSTATE. */
+extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
+ int *__detachstate)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the detachstate attribute in *ATTR to
+ DETACHSTATE. */
+extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
+ int __detachstate)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the guardsize attribute in *ATTR in
+ *GUARDSIZE. */
+extern int pthread_attr_getguardsize (const pthread_attr_t *__restrict __attr,
+ size_t *__restrict __guardsize)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the guardsize attribute in *ATTR to GUARDSIZE. */
+extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
+ size_t __guardsize)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the stacksize attribute in *ATTR in
+ *STACKSIZE. */
+extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr,
+ size_t *__restrict __stacksize)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the stacksize attribute in *ATTR to STACKSIZE. */
+extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
+ size_t __stacksize)
+ __THROW __nonnull ((1));
+
+#ifdef __USE_GNU
+/* Initialize thread attribute *ATTR with attributes corresponding to the
+ already running thread THREAD. It shall be called on an uninitialized ATTR
+ and destroyed with pthread_attr_destroy when no longer needed. */
+extern int pthread_getattr_np (pthread_t __thr, pthread_attr_t *__attr)
+ __THROW __nonnull ((2));
+#endif
+
+
+/* Create a thread with attributes given by ATTR, executing
+ START_ROUTINE with argument ARG. */
+extern int pthread_create (pthread_t *__restrict __threadp,
+ __const pthread_attr_t *__restrict __attr,
+ void *(*__start_routine)(void *),
+ void *__restrict __arg) __THROWNL __nonnull ((1, 3));
+
+/* Terminate the current thread and make STATUS available to any
+ thread that might join us. */
+extern void pthread_exit (void *__status) __attribute__ ((__noreturn__));
+
+/* Make calling thread wait for termination of thread THREAD. Return
+ the exit status of the thread in *STATUS. */
+extern int pthread_join (pthread_t __threadp, void **__status);
+
+/* Indicate that the storage for THREAD can be reclaimed when it
+ terminates. */
+extern int pthread_detach (pthread_t __threadp);
+
+/* Compare thread IDs T1 and T2. Return nonzero if they are equal, 0
+ if they are not. */
+extern int pthread_equal (pthread_t __t1, pthread_t __t2);
+
+#ifdef __USE_EXTERN_INLINES
+
+__extern_inline int
+pthread_equal (pthread_t __t1, pthread_t __t2)
+{
+ return __pthread_equal (__t1, __t2);
+}
+
+#endif /* Use extern inlines. */
+
+
+/* Return the thread ID of the calling thread. */
+extern pthread_t pthread_self (void) __THROW;
+
+
+/* Mutex attributes. */
+
+#define PTHREAD_PRIO_NONE_NP __PTHREAD_PRIO_NONE
+#define PTHREAD_PRIO_INHERIT_NP __PTHREAD_PRIO_INHERIT
+#define PTHREAD_PRIO_PROTECT_NP __PTHREAD_PRIO_PROTECT
+#ifdef __USE_UNIX98
+# define PTHREAD_PRIO_NONE PTHREAD_PRIO_NONE_NP
+# define PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT_NP
+# define PTHREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT_NP
+#endif
+
+#define PTHREAD_MUTEX_TIMED_NP __PTHREAD_MUTEX_TIMED
+#define PTHREAD_MUTEX_ERRORCHECK_NP __PTHREAD_MUTEX_ERRORCHECK
+#define PTHREAD_MUTEX_RECURSIVE_NP __PTHREAD_MUTEX_RECURSIVE
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
+# define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_TIMED_NP
+# define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP
+# define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
+# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
+#endif
+#ifdef __USE_GNU
+/* For compatibility. */
+# define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_TIMED_NP
+#endif
+
+#ifdef __USE_XOPEN2K
+# define PTHREAD_MUTEX_STALLED __PTHREAD_MUTEX_STALLED
+# define PTHREAD_MUTEX_ROBUST __PTHREAD_MUTEX_ROBUST
+#endif
+
+#include
+
+/* Initialize the mutex attribute object in *ATTR to the default
+ values. */
+extern int pthread_mutexattr_init(pthread_mutexattr_t *__attr)
+ __THROW __nonnull ((1));
+
+/* Destroy the mutex attribute structure in *ATTR. */
+extern int pthread_mutexattr_destroy(pthread_mutexattr_t *__attr)
+ __THROW __nonnull ((1));
+
+
+#ifdef __USE_UNIX98
+/* Return the value of the prioceiling attribute in *ATTR in
+ *PRIOCEILING. */
+extern int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict __attr,
+ int *__restrict __prioceiling)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the prioceiling attribute in *ATTR to
+ PRIOCEILING. */
+extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *__attr,
+ int __prioceiling)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the protocol attribute in *ATTR in
+ *PROTOCOL. */
+extern int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict __attr,
+ int *__restrict __protocol)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the protocol attribute in *ATTR to PROTOCOL. */
+extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *__attr,
+ int __protocol)
+ __THROW __nonnull ((1));
+#endif
+
+#ifdef __USE_XOPEN2K
+/* Get the robustness flag of the mutex attribute ATTR. */
+extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
+ int *__robustness)
+ __THROW __nonnull ((1, 2));
+# ifdef __USE_GNU
+extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr,
+ int *__robustness)
+ __THROW __nonnull ((1, 2));
+# endif
+
+/* Set the robustness flag of the mutex attribute ATTR. */
+extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
+ int __robustness)
+ __THROW __nonnull ((1));
+# ifdef __USE_GNU
+extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
+ int __robustness)
+ __THROW __nonnull ((1));
+# endif
+#endif
+
+
+/* Return the value of the process shared attribute in *ATTR in
+ *PSHARED. */
+extern int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict __attr,
+ int *__restrict __pshared)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the process shared attribute in *ATTR to
+ PSHARED. */
+extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *__attr,
+ int __pshared)
+ __THROW __nonnull ((1));
+
+
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
+/* Return the value of the type attribute in *ATTR in *TYPE. */
+extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict __attr,
+ int *__restrict __type)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the type attribute in *ATTR to TYPE. */
+extern int pthread_mutexattr_settype(pthread_mutexattr_t *__attr,
+ int __type)
+ __THROW __nonnull ((1));
+#endif
+
+
+/* Mutexes. */
+
+#include
+
+#define PTHREAD_MUTEX_INITIALIZER __PTHREAD_MUTEX_INITIALIZER
+/* Static initializer for recursive mutexes. */
+
+#ifdef __USE_GNU
+# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+ __PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
+# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+ __PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#endif
+
+/* Create a mutex with attributes given by ATTR and store it in
+ *__MUTEX. */
+extern int pthread_mutex_init (struct __pthread_mutex *__restrict __mutex,
+ const pthread_mutexattr_t *__restrict __attr)
+ __THROW __nonnull ((1));
+
+/* Destroy the mutex __MUTEX. */
+extern int pthread_mutex_destroy (struct __pthread_mutex *__mutex)
+ __THROW __nonnull ((1));
+
+/* Wait until lock for MUTEX becomes available and lock it. */
+extern int pthread_mutex_lock (pthread_mutex_t *__mutex);
+
+/* Try to lock MUTEX. */
+extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
+ __THROWNL __nonnull ((1));
+
+#ifdef __USE_XOPEN2K
+/* Try to lock MUTEX, block until *ABSTIME if it is already held. */
+extern int pthread_mutex_timedlock (struct __pthread_mutex *__restrict __mutex,
+ const struct timespec *__restrict __abstime)
+ __THROWNL __nonnull ((1, 2));
+#endif
+
+/* Unlock MUTEX. */
+extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
+ __THROWNL __nonnull ((1));
+
+/* Transfer ownership of the mutex MUTEX to the thread TID. The
+ caller must own the lock. */
+extern int __pthread_mutex_transfer_np (struct __pthread_mutex *__mutex,
+ pthread_t __tid)
+ __THROWNL __nonnull ((1));
+
+
+#ifdef __USE_UNIX98
+/* Return the priority ceiling of mutex *MUTEX in *PRIOCEILING. */
+extern int pthread_mutex_getprioceiling (const pthread_mutex_t *__restrict __mutex,
+ int *__restrict __prioceiling)
+ __THROW __nonnull ((1, 2));
+
+/* After acquiring the mutex *MUTEX, set its priority ceiling to PRIO
+ and return the old priority ceiling in *OLDPRIO. Before returning,
+ release the mutex. */
+extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
+ int __prio, int *__restrict __oldprio)
+ __THROW __nonnull ((1, 3));
+#endif
+
+#ifdef __USE_XOPEN2K8
+
+/* Declare the state protected by robust mutex MTXP as consistent. */
+extern int pthread_mutex_consistent (pthread_mutex_t *__mtxp)
+ __THROW __nonnull ((1));
+
+# ifdef __USE_GNU
+extern int pthread_mutex_consistent_np (pthread_mutex_t *__mtxp)
+ __THROW __nonnull ((1));
+# endif
+#endif
+
+
+
+/* Condition attributes. */
+
+#include
+
+/* Initialize the condition attribute in *ATTR to the default
+ values. */
+extern int pthread_condattr_init (pthread_condattr_t *__attr)
+ __THROW __nonnull ((1));
+
+/* Destroy the condition attribute structure in *ATTR. */
+extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
+ __THROW __nonnull ((1));
+
+
+#ifdef __USE_XOPEN2K
+/* Return the value of the clock attribute in *ATTR in *CLOCK_ID. */
+extern int pthread_condattr_getclock (const pthread_condattr_t *__restrict __attr,
+ __clockid_t *__restrict __clock_id)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the clock attribute in *ATTR to CLOCK_ID. */
+extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
+ __clockid_t __clock_id)
+ __THROW __nonnull ((1));
+#endif
+
+
+/* Return the value of the process shared attribute in *ATTR in
+ *PSHARED. */
+extern int pthread_condattr_getpshared (const pthread_condattr_t *__restrict __attr,
+ int *__restrict __pshared)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the process shared attribute in *ATTR to
+ PSHARED. */
+extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
+ int __pshared)
+ __THROW __nonnull ((1));
+
+
+/* Condition variables. */
+
+#include
+
+#define PTHREAD_COND_INITIALIZER __PTHREAD_COND_INITIALIZER
+
+extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
+ const pthread_condattr_t *__restrict __attr)
+ __THROW __nonnull ((1));
+
+extern int pthread_cond_destroy (pthread_cond_t *__cond)
+ __THROW __nonnull ((1));
+
+/* Unblock at least one of the threads that are blocked on condition
+ variable COND. */
+extern int pthread_cond_signal (pthread_cond_t *__cond)
+ __THROWNL __nonnull ((1));
+
+/* Unblock all threads that are blocked on condition variable COND. */
+extern int pthread_cond_broadcast (pthread_cond_t *__cond)
+ __THROWNL __nonnull ((1));
+
+/* Block on condition variable COND. MUTEX should be held by the
+ calling thread. On success, MUTEX will be held by the calling
+ thread. */
+extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
+ pthread_mutex_t *__restrict __mutex)
+ __nonnull ((1, 2));
+
+/* Block on condition variable COND. MUTEX should be held by the
+ calling thread. On success, MUTEX will be held by the calling
+ thread. If the time specified by ABSTIME passes, ETIMEDOUT is
+ returned, and MUTEX will nevertheless be held. */
+extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
+ pthread_mutex_t *__restrict __mutex,
+ __const struct timespec *__restrict __abstime)
+ __nonnull ((1, 2, 3));
+
+
+/* Spin locks. */
+
+#ifdef __USE_XOPEN2K
+
+# include
+
+# define PTHREAD_SPINLOCK_INITIALIZER __PTHREAD_SPIN_LOCK_INITIALIZER
+
+/* Destroy the spin lock object LOCK. */
+extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
+ __nonnull ((1));
+
+/* Initialize the spin lock object LOCK. PSHARED determines whether
+ the spin lock can be operated upon by multiple processes. */
+extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
+ __nonnull ((1));
+
+/* Lock the spin lock object LOCK. If the lock is held by another
+ thread spin until it becomes available. */
+extern int pthread_spin_lock (pthread_spinlock_t *__lock)
+ __nonnull ((1));
+
+/* Lock the spin lock object LOCK. Fail if the lock is held by
+ another thread. */
+extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
+ __nonnull ((1));
+
+/* Unlock the spin lock object LOCK. */
+extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
+ __nonnull ((1));
+
+# if defined __USE_EXTERN_INLINES && defined _LIBC
+
+# include
+
+__extern_inline int
+pthread_spin_destroy (pthread_spinlock_t *__lock)
+{
+ return __pthread_spin_destroy (__lock);
+}
+
+__extern_inline int
+pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
+{
+ return __pthread_spin_init (__lock, __pshared);
+}
+
+__extern_inline int
+pthread_spin_lock (pthread_spinlock_t *__lock)
+{
+ return __pthread_spin_lock (__lock);
+}
+
+__extern_inline int
+pthread_spin_trylock (pthread_spinlock_t *__lock)
+{
+ return __pthread_spin_trylock (__lock);
+}
+
+__extern_inline int
+pthread_spin_unlock (pthread_spinlock_t *__lock)
+{
+ return __pthread_spin_unlock (__lock);
+}
+
+# endif /* Use extern inlines. */
+
+#endif /* XPG6. */
+
+
+/* rwlock attributes. */
+
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
+
+# include
+
+/* Initialize rwlock attribute object in *ATTR to the default
+ values. */
+extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
+ __THROW __nonnull ((1));
+
+/* Destroy the rwlock attribute object in *ATTR. */
+extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the process shared attribute in *ATTR in
+ *PSHARED. */
+extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *__restrict __attr,
+ int *__restrict __pshared)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the process shared atrribute in *ATTR to
+ PSHARED. */
+extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
+ int __pshared)
+ __THROW __nonnull ((1));
+
+/* Return current setting of reader/writer preference. */
+extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
+ __restrict __attr,
+ int *__restrict __pref)
+ __THROW __nonnull ((1, 2));
+
+/* Set reader/write preference. */
+extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
+ int __pref) __THROW __nonnull ((1));
+
+
+/* rwlocks. */
+
+# include
+
+# define PTHREAD_RWLOCK_INITIALIZER __PTHREAD_RWLOCK_INITIALIZER
+/* Create a rwlock object with attributes given by ATTR and strore the
+ result in *RWLOCK. */
+extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
+ const pthread_rwlockattr_t *__restrict __attr)
+ __THROW __nonnull ((1));
+
+/* Destroy the rwlock *RWLOCK. */
+extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
+ __THROW __nonnull ((1));
+
+/* Acquire the rwlock *RWLOCK for reading. */
+extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
+ __THROWNL __nonnull ((1));
+
+/* Acquire the rwlock *RWLOCK for reading. */
+extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
+ __THROWNL __nonnull ((1));
+
+# ifdef __USE_XOPEN2K
+/* Acquire the rwlock *RWLOCK for reading blocking until *ABSTIME if
+ it is already held. */
+extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *__restrict __rwlock,
+ const struct timespec *__restrict __abstime)
+ __THROWNL __nonnull ((1, 2));
+# endif
+
+/* Acquire the rwlock *RWLOCK for writing. */
+extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
+ __THROWNL __nonnull ((1));
+
+/* Try to acquire the rwlock *RWLOCK for writing. */
+extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
+ __THROWNL __nonnull ((1));
+
+# ifdef __USE_XOPEN2K
+/* Acquire the rwlock *RWLOCK for writing blocking until *ABSTIME if
+ it is already held. */
+extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *__restrict __rwlock,
+ const struct timespec *__restrict __abstime)
+ __THROWNL __nonnull ((1, 2));
+# endif
+
+/* Release the lock held by the current thread on *RWLOCK. */
+extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
+ __THROWNL __nonnull ((1));
+
+#endif /* __USE_UNIX98 || __USE_XOPEN2K */
+
+
+
+/* Cancelation. */
+
+/* Register a cleanup handler. */
+extern void pthread_cleanup_push (void (*__routine) (void *), void *__arg);
+
+/* Unregister a cleanup handler. */
+extern void pthread_cleanup_pop (int __execute);
+
+#include
+
+#define pthread_cleanup_push(rt, rtarg) __pthread_cleanup_push(rt, rtarg)
+#define pthread_cleanup_pop(execute) __pthread_cleanup_pop(execute)
+
+#define PTHREAD_CANCEL_DISABLE 0
+#define PTHREAD_CANCEL_ENABLE 1
+
+/* Return the calling thread's cancelation state in *OLDSTATE and set
+ its state to STATE. */
+extern int pthread_setcancelstate (int __state, int *__oldstate);
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+/* Return the calling thread's cancelation type in *OLDTYPE and set
+ its type to TYPE. */
+extern int pthread_setcanceltype (int __type, int *__oldtype);
+
+/* Value returned by pthread_join if the target thread was
+ canceled. */
+#define PTHREAD_CANCELED ((void *) -1)
+
+/* Cancel THEAD. */
+extern int pthread_cancel (pthread_t __thr);
+
+/* Add an explicit cancelation point. */
+extern void pthread_testcancel (void);
+
+
+/* Barriers attributes. */
+
+#ifdef __USE_XOPEN2K
+
+# include
+
+/* Initialize barrier attribute object in *ATTR to the default
+ values. */
+extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
+ __THROW __nonnull ((1));
+
+/* Destroy the barrier attribute object in *ATTR. */
+extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
+ __THROW __nonnull ((1));
+
+
+/* Return the value of the process shared attribute in *ATTR in
+ *PSHARED. */
+extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *__restrict __attr,
+ int *__restrict __pshared)
+ __THROW __nonnull ((1, 2));
+
+/* Set the value of the process shared atrribute in *ATTR to
+ PSHARED. */
+extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
+ int __pshared)
+ __THROW __nonnull ((1));
+
+
+/* Barriers. */
+
+# include
+
+/* Returned by pthread_barrier_wait to exactly one thread each time a
+ barrier is passed. */
+# define PTHREAD_BARRIER_SERIAL_THREAD -1
+
+/* Initialize barrier BARRIER. */
+extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
+ const pthread_barrierattr_t *__restrict __attr,
+ unsigned __count)
+ __THROW __nonnull ((1));
+
+/* Destroy barrier BARRIER. */
+extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
+ __THROW __nonnull ((1));
+
+/* Wait on barrier BARRIER. */
+extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
+ __THROWNL __nonnull ((1));
+
+#endif /* __USE_XOPEN2K */
+
+
+
+/* Thread specific data. */
+
+#include
+
+/* Create a thread specific data key in KEY visible to all threads.
+ On thread destruction, DESTRUCTOR shall be called with the thread
+ specific data associate with KEY if it is not NULL. */
+extern int pthread_key_create (pthread_key_t *__key,
+ void (*__destructor) (void *))
+ __THROW __nonnull ((1));
+
+/* Delete the thread specific data key KEY. The associated destructor
+ function is not called. */
+extern int pthread_key_delete (pthread_key_t __key) __THROW;
+
+/* Return the caller thread's thread specific value of KEY. */
+extern void *pthread_getspecific (pthread_key_t __key) __THROW;
+
+/* Set the caller thread's thread specific value of KEY to VALUE. */
+extern int pthread_setspecific (pthread_key_t __key, const void *__value)
+ __THROW;
+
+
+/* Dynamic package initialization. */
+
+#include
+
+#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
+
+/* Call INIT_ROUTINE if this function has never been called with
+ *ONCE_CONTROL, otherwise do nothing. */
+extern int pthread_once (pthread_once_t *__once_control,
+ void (*__init_routine) (void)) __nonnull ((1, 2));
+
+
+/* Concurrency. */
+
+#ifdef __USE_UNIX98
+/* Set the desired concurrency level to NEW_LEVEL. */
+extern int pthread_setconcurrency (int __new_level) __THROW;
+
+/* Get the current concurrency level. */
+extern int pthread_getconcurrency (void) __THROW;
+#endif
+
+
+/* Forking. */
+
+/* Register the function PREPARE to be run before the process forks,
+ the function PARENT to be run after a fork in the parent and the
+ function CHILD to be run in the child after the fork. If no
+ handling is desired then any of PREPARE, PARENT and CHILD may be
+ NULL. The prepare handles will be called in the reverse order
+ which they were registered and the parent and child handlers in the
+ order in which they were registered. */
+extern int pthread_atfork (void (*__prepare) (void), void (*__parent) (void),
+ void (*__child) (void)) __THROW;
+
+
+/* Signals (should be in ). */
+
+/* Send signal SIGNO to thread THREAD. */
+extern int pthread_kill (pthread_t __thr, int __signo) __THROW;
+
+
+/* Time. */
+
+#ifdef __USE_XOPEN2K
+/* Return the thread cpu clock. */
+extern int pthread_getcpuclockid (pthread_t __thr, __clockid_t *__clock)
+ __THROW __nonnull ((2));
+#endif
+
+
+/* Scheduling. */
+
+/* Return thread THREAD's scheduling paramters. */
+extern int pthread_getschedparam (pthread_t __thr, int *__restrict __policy,
+ struct sched_param *__restrict __param)
+ __THROW __nonnull ((2, 3));
+
+/* Set thread THREAD's scheduling paramters. */
+extern int pthread_setschedparam (pthread_t __thr, int __policy,
+ const struct sched_param *__param)
+ __THROW __nonnull ((3));
+
+/* Set thread THREAD's scheduling priority. */
+extern int pthread_setschedprio (pthread_t __thr, int __prio) __THROW;
+
+#ifdef __USE_GNU
+/* Yield the processor to another thread or process.
+ This function is similar to the POSIX `sched_yield' function but
+ might be differently implemented in the case of a m-on-n thread
+ implementation. */
+extern int pthread_yield (void) __THROW;
+#endif
+
+
+/* Kernel-specific interfaces. */
+
+#include
+
+
+__END_DECLS
+
+#endif /* pthread.h */
diff --git a/libc/glibc/sysdeps/i386/crti.S b/libc/glibc/sysdeps/i386/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..65357682a0956bbd137806796307f6680b79912c
--- /dev/null
+++ b/libc/glibc/sysdeps/i386/crti.S
@@ -0,0 +1,88 @@
+/* Special .init and .fini section support for x86.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .p2align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ _CET_ENDBR
+ pushl %ebx
+ /* Maintain 16-byte stack alignment for called functions. */
+ subl $8, %esp
+ LOAD_PIC_REG (bx)
+#if PREINIT_FUNCTION_WEAK
+ movl PREINIT_FUNCTION@GOT(%ebx), %eax
+ testl %eax, %eax
+ je .Lno_weak_fn
+ call *%eax
+.Lno_weak_fn:
+#else
+ call PREINIT_FUNCTION
+#endif
+
+ .section .fini,"ax",@progbits
+ .p2align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ _CET_ENDBR
+ pushl %ebx
+ subl $8, %esp
+ LOAD_PIC_REG (bx)
diff --git a/libc/glibc/sysdeps/i386/crtn.S b/libc/glibc/sysdeps/i386/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..e7921af6d2f90de12100985a79fc91d9bbfae5c1
--- /dev/null
+++ b/libc/glibc/sysdeps/i386/crtn.S
@@ -0,0 +1,47 @@
+/* Special .init and .fini section support for x86.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",@progbits
+ addl $8, %esp
+ popl %ebx
+ ret
+
+ .section .fini,"ax",@progbits
+ addl $8, %esp
+ popl %ebx
+ ret
diff --git a/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..60f524fb74f1ba4243e1bebf81a3c74d3741ba2d
--- /dev/null
+++ b/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h
@@ -0,0 +1,22 @@
+/* Machine-specific pthread type layouts. Hurd i386 version.
+ Copyright (C) 2002-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/i386/start.S b/libc/glibc/sysdeps/i386/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..202a5763f78157e68a6b0d71c51de819f228f261
--- /dev/null
+++ b/libc/glibc/sysdeps/i386/start.S
@@ -0,0 +1,151 @@
+/* Startup code compliant to the ELF i386 ABI.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
+ point runs, most registers' values are unspecified, except for:
+
+ %edx Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ %esp The stack contains the arguments and environment:
+ 0(%esp) argc
+ 4(%esp) argv[0]
+ ...
+ (4*argc)(%esp) NULL
+ (4*(argc+1))(%esp) envp[0]
+ ...
+ NULL
+*/
+
+#include
+
+ENTRY (_start)
+ /* Clearing frame pointer is insufficient, use CFI. */
+ cfi_undefined (eip)
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+
+ /* Extract the arguments as encoded on the stack and set up
+ the arguments for `main': argc, argv. envp will be determined
+ later in __libc_start_main. */
+ popl %esi /* Pop the argument count. */
+ movl %esp, %ecx /* argv starts just at the current stack top.*/
+
+ /* Before pushing the arguments align the stack to a 16-byte
+ (SSE needs 16-byte alignment) boundary to avoid penalties from
+ misaligned accesses. Thanks to Edward Seidl
+ for pointing this out. */
+ andl $0xfffffff0, %esp
+ pushl %eax /* Push garbage because we allocate
+ 28 more bytes. */
+
+ /* Provide the highest stack address to the user code (for stacks
+ which grow downwards). */
+ pushl %esp
+
+ pushl %edx /* Push address of the shared library
+ termination function. */
+
+#ifdef PIC
+ /* Load PIC register. */
+ call 1f
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+
+ /* Push address of our own entry points to .fini and .init. */
+ leal __libc_csu_fini@GOTOFF(%ebx), %eax
+ pushl %eax
+ leal __libc_csu_init@GOTOFF(%ebx), %eax
+ pushl %eax
+
+ pushl %ecx /* Push second argument: argv. */
+ pushl %esi /* Push first argument: argc. */
+
+# ifdef SHARED
+ pushl main@GOT(%ebx)
+# else
+ /* Avoid relocation in static PIE since _start is called before
+ it is relocated. Don't use "leal main@GOTOFF(%ebx), %eax"
+ since main may be in a shared object. Linker will convert
+ "movl main@GOT(%ebx), %eax" to "leal main@GOTOFF(%ebx), %eax"
+ if main is defined locally. */
+ movl main@GOT(%ebx), %eax
+ pushl %eax
+# endif
+
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
+ call __libc_start_main@PLT
+#else
+ /* Push address of our own entry points to .fini and .init. */
+ pushl $__libc_csu_fini
+ pushl $__libc_csu_init
+
+ pushl %ecx /* Push second argument: argv. */
+ pushl %esi /* Push first argument: argc. */
+
+ pushl $main
+
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
+ call __libc_start_main
+#endif
+
+ hlt /* Crash if somehow `exit' does return. */
+
+#ifdef PIC
+1: movl (%esp), %ebx
+ ret
+#endif
+END (_start)
+
+/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so
+ meaningless since we don't support machines < 80386. */
+ .section .rodata
+ .globl _fp_hw
+_fp_hw: .long 3
+ .size _fp_hw, 4
+ .type _fp_hw,@object
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/i386/symbol-hacks.h b/libc/glibc/sysdeps/i386/symbol-hacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..a55e5ea90de74ca1c30fd1b8cc09254f15f43c04
--- /dev/null
+++ b/libc/glibc/sysdeps/i386/symbol-hacks.h
@@ -0,0 +1,21 @@
+/* Hacks needed for symbol manipulation. i386 version.
+ Copyright (C) 2017-2019 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
+ . */
+
+#include
+
+#include_next "symbol-hacks.h"
diff --git a/libc/glibc/sysdeps/i386/sysdep.h b/libc/glibc/sysdeps/i386/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..749b55b07787f4bc4f3e426eb2f197cc2b702ca1
--- /dev/null
+++ b/libc/glibc/sysdeps/i386/sysdep.h
@@ -0,0 +1,116 @@
+/* Assembler macros for i386.
+ Copyright (C) 1991-2019 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
+ . */
+
+#include
+
+#include /* For __GNUC_PREREQ. */
+
+/* It is desirable that the names of PIC thunks match those used by
+ GCC so that multiple copies are eliminated by the linker. Because
+ GCC 4.6 and earlier use __i686 in the names, it is necessary to
+ override that predefined macro. */
+#if defined __i686 && defined __ASSEMBLER__
+#undef __i686
+#define __i686 __i686
+#endif
+
+#ifdef __ASSEMBLER__
+# define GET_PC_THUNK(reg) __x86.get_pc_thunk.reg
+#else
+# define GET_PC_THUNK_STR(reg) "__x86.get_pc_thunk." #reg
+#endif
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+/* If compiled for profiling, call `mcount' at the start of each function. */
+#ifdef PROF
+/* The mcount code relies on a normal frame pointer being on the stack
+ to locate our caller, so push one just for its benefit. */
+#define CALL_MCOUNT \
+ pushl %ebp; cfi_adjust_cfa_offset (4); movl %esp, %ebp; \
+ cfi_def_cfa_register (ebp); call JUMPTARGET(mcount); \
+ popl %ebp; cfi_def_cfa (esp, 4);
+#else
+#define CALL_MCOUNT /* Do nothing. */
+#endif
+
+#define PSEUDO(name, syscall_name, args) \
+ .globl syscall_error; \
+lose: SYSCALL_PIC_SETUP \
+ jmp JUMPTARGET(syscall_error); \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args); \
+ jb lose
+
+# define SETUP_PIC_REG(reg) \
+ .ifndef GET_PC_THUNK(reg); \
+ .section .gnu.linkonce.t.GET_PC_THUNK(reg),"ax",@progbits; \
+ .globl GET_PC_THUNK(reg); \
+ .hidden GET_PC_THUNK(reg); \
+ .p2align 4; \
+ .type GET_PC_THUNK(reg),@function; \
+GET_PC_THUNK(reg): \
+ movl (%esp), %e##reg; \
+ ret; \
+ .size GET_PC_THUNK(reg), . - GET_PC_THUNK(reg); \
+ .previous; \
+ .endif; \
+ call GET_PC_THUNK(reg)
+
+# define LOAD_PIC_REG(reg) \
+ SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg
+
+#undef JUMPTARGET
+#ifdef PIC
+#define JUMPTARGET(name) name##@PLT
+#define SYSCALL_PIC_SETUP \
+ pushl %ebx; \
+ cfi_adjust_cfa_offset (4); \
+ call 0f; \
+0: popl %ebx; \
+ cfi_adjust_cfa_offset (-4); \
+ addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ebx;
+
+#else
+#define JUMPTARGET(name) name
+#define SYSCALL_PIC_SETUP /* Nothing. */
+#endif
+
+#else /* __ASSEMBLER__ */
+
+# define SETUP_PIC_REG_STR(reg) \
+ ".ifndef " GET_PC_THUNK_STR (reg) "\n" \
+ ".section .gnu.linkonce.t." GET_PC_THUNK_STR (reg) ",\"ax\",@progbits\n" \
+ ".globl " GET_PC_THUNK_STR (reg) "\n" \
+ ".hidden " GET_PC_THUNK_STR (reg) "\n" \
+ ".p2align 4\n" \
+ ".type " GET_PC_THUNK_STR (reg) ",@function\n" \
+GET_PC_THUNK_STR (reg) ":" \
+ "movl (%%esp), %%e" #reg "\n" \
+ "ret\n" \
+ ".size " GET_PC_THUNK_STR (reg) ", . - " GET_PC_THUNK_STR (reg) "\n" \
+ ".previous\n" \
+ ".endif\n" \
+ "call " GET_PC_THUNK_STR (reg)
+
+# define LOAD_PIC_REG_STR(reg) \
+ SETUP_PIC_REG_STR (reg) "\naddl $_GLOBAL_OFFSET_TABLE_, %%e" #reg
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/ia64/crti.S b/libc/glibc/sysdeps/ia64/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..05b3bc913fe6fbef87f9c1c468bde7600419f5d5
--- /dev/null
+++ b/libc/glibc/sysdeps/ia64/crti.S
@@ -0,0 +1,162 @@
+/* Special .init and .fini section support for IA64.
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+#undef ret
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+/* If we have working .init_array support, we want to keep the .init
+ section empty (apart from the mandatory prologue/epilogue. This
+ ensures that the default unwind conventions (return-pointer in b0,
+ frame state in ar.pfs, etc.) will do the Right Thing. To ensure
+ an empty .init section, we register gmon_initializer() via the
+ .init_array.
+
+ --davidm 02/10/29 */
+
+#if PREINIT_FUNCTION_WEAK
+/* This blob of assembly code is one simple C function:
+
+static void
+__attribute__ ((used))
+gmon_initializer (void)
+{
+ extern void weak_function __gmon_start__ (void);
+
+ if (__gmon_start__)
+ (*__gmon_start__)();
+}
+ */
+ .text
+ .align 64
+ .proc gmon_initializer#
+gmon_initializer:
+ .prologue 12, 32
+ .mmi
+ .save ar.pfs, r33
+ alloc r33 = ar.pfs, 0, 3, 0, 0
+ addl r14 = @ltoff(@fptr(PREINIT_FUNCTION#)), gp
+ .save rp, r32
+ mov r32 = b0
+ .mmi
+ mov r34 = r1
+ .body
+ ;;
+ ld8 r14 = [r14]
+ nop 0
+ ;;
+ .mib
+ cmp.eq p6, p7 = 0, r14
+ nop 0
+ (p6) br.cond.spnt .L1
+ ;;
+ .mib
+ nop 0
+ nop 0
+ br.call.sptk.many b0 = PREINIT_FUNCTION#
+ ;;
+ .mmi
+ mov r1 = r34
+ nop 0
+ nop 0
+.L1:
+ .mii
+ nop 0
+ mov ar.pfs = r33
+ nop 0
+ ;;
+ .mib
+ nop 0
+ mov b0 = r32
+ br.ret.sptk.many b0
+ .endp gmon_initializer#
+# undef PREINIT_FUNCTION
+# define PREINIT_FUNCTION gmon_initializer
+#endif
+ .section .init_array, "aw"
+ data8 @fptr(PREINIT_FUNCTION)
+
+ .section .init,"ax",@progbits
+ .global _init#
+ .hidden _init#
+ .proc _init#
+_init:
+ .prologue
+ .save ar.pfs, r34
+ alloc r34 = ar.pfs, 0, 3, 0, 0
+ .vframe r32
+ mov r32 = r12
+ .save rp, r33
+ mov r33 = b0
+ .body
+ adds r12 = -16, r12
+ ;; /* see gmon_initializer() above */
+ .endp _init#
+
+ .section .fini,"ax",@progbits
+ .global _fini#
+ .hidden _fini#
+ .proc _fini#
+_fini:
+ .prologue
+ .save ar.pfs, r34
+ alloc r34 = ar.pfs, 0, 3, 0, 0
+ .vframe r32
+ mov r32 = r12
+ .save rp, r33
+ mov r33 = b0
+ .body
+ adds r12 = -16, r12
+ ;;
+ .endp _fini#
diff --git a/libc/glibc/sysdeps/ia64/crtn.S b/libc/glibc/sysdeps/ia64/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..cd22953f0b29f24c4dc7eac0ccdad711f518888f
--- /dev/null
+++ b/libc/glibc/sysdeps/ia64/crtn.S
@@ -0,0 +1,69 @@
+/* Special .init and .fini section support for ARM.
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+#include
+#undef ret
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",@progbits
+ .proc _init#
+_init:
+ .prologue
+ .save ar.pfs, r34
+ .vframe r32
+ .save rp, r33
+ .body
+ .regstk 0,2,0,0
+ mov r12 = r32
+ mov ar.pfs = r34
+ mov b0 = r33
+ br.ret.sptk.many b0
+ .endp _init#
+
+ .section .fini,"ax",@progbits
+ .proc _fini#
+_fini:
+ .prologue
+ .save ar.pfs, r34
+ .vframe r32
+ .save rp, r33
+ .body
+ mov r12 = r32
+ mov ar.pfs = r34
+ mov b0 = r33
+ br.ret.sptk.many b0
+ .endp _fini#
diff --git a/libc/glibc/sysdeps/ia64/dl-dtprocnum.h b/libc/glibc/sysdeps/ia64/dl-dtprocnum.h
new file mode 100644
index 0000000000000000000000000000000000000000..17b5476c30421f48d52e3f89d312c386bd5b364e
--- /dev/null
+++ b/libc/glibc/sysdeps/ia64/dl-dtprocnum.h
@@ -0,0 +1,21 @@
+/* Configuration of lookup functions. IA-64 version.
+ Copyright (C) 2000-2019 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
+ . */
+
+/* Number of extra dynamic section entries for this architecture. By
+ default there are none. */
+#define DT_THISPROCNUM DT_IA_64_NUM
diff --git a/libc/glibc/sysdeps/ia64/dl-sysdep.h b/libc/glibc/sysdeps/ia64/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..d827aee5c772a1f943d06a5f535dafaba59842c3
--- /dev/null
+++ b/libc/glibc/sysdeps/ia64/dl-sysdep.h
@@ -0,0 +1,23 @@
+/* System-specific settings for dynamic linker code. IA-64 version.
+ Copyright (C) 2002-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
diff --git a/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f932bb9a9812bd6448babde8922abb163ad3fb0
--- /dev/null
+++ b/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,63 @@
+/* Copyright (C) 2003-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek , 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#define __SIZEOF_PTHREAD_ATTR_T 56
+#define __SIZEOF_PTHREAD_MUTEX_T 40
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 56
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 32
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
+#define __PTHREAD_MUTEX_USE_UNION 0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+/* Data structure for reader-write lock variable handling. The
+ structure of the attribute type is not exposed on purpose. */
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/ia64/start.S b/libc/glibc/sysdeps/ia64/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..0ddc06ef57589f694659ec16327073b3d66d284d
--- /dev/null
+++ b/libc/glibc/sysdeps/ia64/start.S
@@ -0,0 +1,119 @@
+/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Jes Sorensen, , April 1999.
+
+ 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
+ . */
+
+#include
+
+#include
+#include
+
+/*
+ * Arguments for __libc_start_main:
+ * out0: main
+ * out1: argc
+ * out2: argv
+ * out3: init
+ * out4: fini
+ * out5: rtld_fini
+ * out6: stack_end
+ */
+
+ .align 32
+ .global _start
+
+ .proc _start
+ .type _start,@function
+_start:
+ .prologue
+ .save rp, r0
+ .body
+ .prologue
+ { .mlx
+ alloc r2 = ar.pfs,0,0,7,0
+ movl r3 = FPSR_DEFAULT
+ }
+ { .mlx
+ adds out2 = 16, sp /* get address of argc value */
+ movl gp = @gprel(0f)
+ ;;
+ }
+0: { .mmi
+ ld8 out1 = [out2], 8 /* load argc and move out2 to become argv */
+ mov.m r10 = ar.bsp /* fetch rbs base address */
+ mov r9 = ip
+ ;;
+ }
+ { .mii
+ mov ar.fpsr = r3
+ sub gp = r9, gp /* back-compute gp value */
+ adds out6 = 16, sp /* highest non-environment stack address */
+ ;;
+ }
+ {
+ addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
+ addl out0 = @ltoff(@fptr(main)), gp
+ addl out3 = @ltoff(@fptr(__libc_csu_init)), gp
+ ;;
+ }
+ { .mmi
+ ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
+ ld8 out0 = [out0] /* pointer to `main' function descriptor */
+ addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp
+ ;;
+ }
+ { .mmi
+ ld8 out3 = [out3] /* pointer to `init' function descriptor */
+ ld8 out4 = [out4] /* pointer to `fini' function descriptor */
+ nop 0
+ }
+ .body
+ { .mib
+ st8 [r3] = r10
+ mov out5 = ret0 /* dynamic linker destructor */
+ br.call.sptk.few rp = __libc_start_main
+ }
+ { .mib
+ break 0 /* break miserably if we ever return */
+ }
+ .endp _start
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
+
+ .common __libc_ia64_register_backing_store_base, 8, 8
diff --git a/libc/glibc/sysdeps/ia64/sysdep.h b/libc/glibc/sysdeps/ia64/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..29181e768673a235eaa1992822e865dfe6007d99
--- /dev/null
+++ b/libc/glibc/sysdeps/ia64/sysdep.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Mosberger-Tang
+
+ 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Macros to help writing .prologue directives in assembly code. */
+#define ASM_UNW_PRLG_RP 0x8
+#define ASM_UNW_PRLG_PFS 0x4
+#define ASM_UNW_PRLG_PSP 0x2
+#define ASM_UNW_PRLG_PR 0x1
+#define ASM_UNW_PRLG_GRSAVE(ninputs) (32+(ninputs))
+
+#define ENTRY(name) \
+ .text; \
+ .align 32; \
+ .proc C_SYMBOL_NAME(name); \
+ .global C_SYMBOL_NAME(name); \
+ C_LABEL(name) \
+ CALL_MCOUNT
+
+#define LOCAL_ENTRY(name) \
+ .text; \
+ .align 32; \
+ .proc C_SYMBOL_NAME(name); \
+ C_LABEL(name) \
+ CALL_MCOUNT
+
+#define LEAF(name) \
+ .text; \
+ .align 32; \
+ .proc C_SYMBOL_NAME(name); \
+ .global name; \
+ C_LABEL(name)
+
+#define LOCAL_LEAF(name) \
+ .text; \
+ .align 32; \
+ .proc C_SYMBOL_NAME(name); \
+ C_LABEL(name)
+
+/* Mark the end of function SYM. */
+#undef END
+#define END(sym) .endp C_SYMBOL_NAME(sym)
+
+#endif /* ASSEMBLER */
diff --git a/libc/glibc/sysdeps/init_array/crti.S b/libc/glibc/sysdeps/init_array/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..145c918f939b7917c84f775407c62dc45d2e70b5
--- /dev/null
+++ b/libc/glibc/sysdeps/init_array/crti.S
@@ -0,0 +1,27 @@
+/* Dummy crti 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. */
+
+#ifdef PREINIT_FUNCTION
+
+#if PREINIT_FUNCTION_WEAK
+# error PREINIT_FUNCTION_WEAK is unsupported
+#endif
+
+/* This arranges for PREINIT_FUNCTION to be called upon loading a library that
+ contains crti.o. */
+
+ .section .init_array,"a",%init_array
+ .dc.a PREINIT_FUNCTION
+
+#endif
diff --git a/libc/glibc/sysdeps/init_array/crtn.S b/libc/glibc/sysdeps/init_array/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..6f70e771608d0aff54a1ec67312fabbfa78b08be
--- /dev/null
+++ b/libc/glibc/sysdeps/init_array/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/glibc/sysdeps/m68k/bits/endian.h b/libc/glibc/sysdeps/m68k/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf4ecb60a4c2b8af24a2357de9c23b2975e0fcc2
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/bits/endian.h
@@ -0,0 +1,7 @@
+/* m68k is big-endian. */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/libc/glibc/sysdeps/m68k/coldfire/sysdep.h b/libc/glibc/sysdeps/m68k/coldfire/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..90c2833a19022a787cb0651cc98b90e0990e6293
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/coldfire/sysdep.h
@@ -0,0 +1,40 @@
+/* Assembler macros for Coldfire.
+ Copyright (C) 1998-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Perform operation OP with PC-relative SRC as the first operand and
+ DST as the second. TMP is available as a temporary if needed. */
+# define PCREL_OP(OP, SRC, DST, TMP) \
+ move.l &SRC - ., TMP; OP (-8, %pc, TMP), DST
+
+/* Load the address of the GOT into register R. */
+# define LOAD_GOT(R) \
+ move.l &_GLOBAL_OFFSET_TABLE_@GOTPC, R; \
+ lea (-6, %pc, R), R
+
+#else
+
+/* As above, but PC is the spelling of the PC register. We need this
+ so that the macro can be used in both normal and extended asms. */
+# define PCREL_OP(OP, SRC, DST, TMP, PC) \
+ "move.l #" SRC " - ., " TMP "\n\t" OP " (-8, " PC ", " TMP "), " DST
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/m68k/crti.S b/libc/glibc/sysdeps/m68k/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..f6a93773244d4bc8e1fa0fdba96dfa45402c0842
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/crti.S
@@ -0,0 +1,84 @@
+/* Special .init and .fini section support for m68k.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ link.w %fp, #0
+ move.l %a5, -(%sp)
+ LOAD_GOT (%a5)
+#if PREINIT_FUNCTION_WEAK
+ tst.l PREINIT_FUNCTION@GOT(%a5)
+ jeq 1f
+ jbsr PREINIT_FUNCTION@PLTPC
+1:
+#else
+ jbsr PREINIT_FUNCTION
+#endif
+
+ .section .fini,"ax",@progbits
+ .align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ link.w %fp, #0
+ move.l %a5, -(%sp)
+ LOAD_GOT (%a5)
diff --git a/libc/glibc/sysdeps/m68k/crtn.S b/libc/glibc/sysdeps/m68k/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..dffa96f404981ca54e02450807b35616fdf9e52b
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/crtn.S
@@ -0,0 +1,47 @@
+/* Special .init and .fini section support for m68k.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",@progbits
+ move.l -4(%fp), %a5
+ unlk %fp
+ rts
+
+ .section .fini,"ax",@progbits
+ move.l -4(%fp), %a5
+ unlk %fp
+ rts
diff --git a/libc/glibc/sysdeps/m68k/m680x0/sysdep.h b/libc/glibc/sysdeps/m68k/m680x0/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..e426cfdb709859c2fbd28246f3ac3a2bd30e3af1
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/m680x0/sysdep.h
@@ -0,0 +1,39 @@
+/* Assembler macros for m680x0.
+ Copyright (C) 2010-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Perform operation OP with PC-relative SRC as the first operand and
+ DST as the second. TMP is available as a temporary if needed. */
+# define PCREL_OP(OP, SRC, DST, TMP) \
+ OP SRC(%pc), DST
+
+/* Load the address of the GOT into register R. */
+# define LOAD_GOT(R) \
+ lea _GLOBAL_OFFSET_TABLE_@GOTPC (%pc), R
+
+#else
+
+/* As above, but PC is the spelling of the PC register. We need this
+ so that the macro can be used in both normal and extended asms. */
+#define PCREL_OP(OP, SRC, DST, TMP, PC) \
+ OP " " SRC "(" PC "), " DST
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..731cdec69a9791f6393f482ed2cda231bfc71fca
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,63 @@
+/* Copyright (C) 2010-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Maxim Kuvyrkov , 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
+ 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 32
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
+#define __PTHREAD_MUTEX_USE_UNION 1
+
+#define __LOCK_ALIGNMENT __attribute__ ((__aligned__ (4)))
+#define __ONCE_ALIGNMENT __attribute__ ((__aligned__ (4)))
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers __attribute__ ((__aligned__ (4)));
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/m68k/start.S b/libc/glibc/sysdeps/m68k/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..05fd964ab6439020649c4ec6a7cfbb1473dff195
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/start.S
@@ -0,0 +1,120 @@
+/* Startup code compliant to the ELF m68k ABI.
+ Copyright (C) 1996-2019 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.
+
+ 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
+ . */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment. The SVR4/m68k ABI says that when the entry point runs,
+ most registers' values are unspecified, except for:
+
+ %a1 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ %sp The stack contains the arguments and environment:
+ 0(%sp) argc
+ 4(%sp) argv[0]
+ ...
+ (4*argc)(%sp) NULL
+ (4*(argc+1))(%sp) envp[0]
+ ...
+ NULL
+*/
+
+#include
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ sub.l %fp, %fp
+
+ /* Extract the arguments as encoded on the stack and set up the
+ arguments for `main': argc, argv. envp will be determined
+ later in __libc_start_main. */
+ move.l (%sp)+, %d0 /* Pop the argument count. */
+ move.l %sp, %a0 /* The argument vector starts just at the
+ current stack top. */
+
+ /* Provide the highest stack address to the user code (for stacks
+ which grow downward). */
+ pea (%sp)
+
+ pea (%a1) /* Push address of the shared library
+ termination function. */
+
+#ifdef PIC
+ /* Load PIC register. */
+ LOAD_GOT (%a5)
+
+ /* Push the address of our own entry points to `.fini' and
+ `.init'. */
+ move.l __libc_csu_fini@GOT(%a5), -(%sp)
+ move.l __libc_csu_init@GOT(%a5), -(%sp)
+
+ pea (%a0) /* Push second argument: argv. */
+ move.l %d0, -(%sp) /* Push first argument: argc. */
+
+ move.l main@GOT(%a5), -(%sp)
+
+ /* Call the user's main function, and exit with its value. But
+ let the libc call main. */
+ jbsr __libc_start_main@PLTPC
+#else
+ /* Push the address of our own entry points to `.fini' and
+ `.init'. */
+ pea __libc_csu_fini
+ pea __libc_csu_init
+
+ pea (%a0) /* Push second argument: argv. */
+ move.l %d0, -(%sp) /* Push first argument: argc. */
+
+ pea main
+
+ /* Call the user's main function, and exit with its value. But
+ let the libc call main. */
+ jbsr __libc_start_main
+#endif
+
+ illegal /* Crash if somehow `exit' does return. */
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/m68k/symbol-hacks.h b/libc/glibc/sysdeps/m68k/symbol-hacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..72eff097cf6881643ca4e188febba71dca5638ce
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/symbol-hacks.h
@@ -0,0 +1,21 @@
+/* Hacks needed for symbol manipulation. m68k version.
+ Copyright (C) 2017-2019 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
+ . */
+
+#include
+
+#include_next "symbol-hacks.h"
diff --git a/libc/glibc/sysdeps/m68k/sysdep.h b/libc/glibc/sysdeps/m68k/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..8543458447683b148862c028420ffd2ea94df7b0
--- /dev/null
+++ b/libc/glibc/sysdeps/m68k/sysdep.h
@@ -0,0 +1,74 @@
+/* Assembler macros for m68k.
+ Copyright (C) 1998-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Define an entry point visible from C.
+
+ There is currently a bug in gdb which prevents us from specifying
+ incomplete stabs information. Fake some entries here which specify
+ the current source file. */
+# define ENTRY(name) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),@function; \
+ .p2align 2; \
+ C_LABEL(name) \
+ cfi_startproc; \
+ CALL_MCOUNT
+
+# undef END
+# define END(name) \
+ cfi_endproc; \
+ .size name,.-name
+
+
+/* If compiled for profiling, call `_mcount' at the start of each function. */
+# ifdef PROF
+/* The mcount code relies on a normal frame pointer being on the stack
+ to locate our caller, so push one just for its benefit. */
+# define CALL_MCOUNT \
+ move.l %fp, -(%sp); \
+ cfi_adjust_cfa_offset (4); cfi_rel_offset (%a6, 0); \
+ move.l %sp, %fp; \
+ jbsr JUMPTARGET (_mcount); \
+ move.l (%sp)+, %fp; \
+ cfi_adjust_cfa_offset (-4); cfi_restore (%a6);
+# else
+# define CALL_MCOUNT /* Do nothing. */
+# endif
+
+# define PSEUDO(name, syscall_name, args) \
+ .globl __syscall_error; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args); \
+ jcc JUMPTARGET(__syscall_error)
+
+# undef PSEUDO_END
+# define PSEUDO_END(name) \
+ END (name)
+
+# undef JUMPTARGET
+# ifdef PIC
+# define JUMPTARGET(name) name##@PLTPC
+# else
+# define JUMPTARGET(name) name
+# endif
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/mach/hurd/bits/stat.h b/libc/glibc/sysdeps/mach/hurd/bits/stat.h
new file mode 100644
index 0000000000000000000000000000000000000000..5ef487e077a2b43bf9957b3552fe955618cd9375
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/hurd/bits/stat.h
@@ -0,0 +1,263 @@
+/* Copyright (C) 1992-2019 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
+ . */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include directly; use instead."
+#endif
+
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H 1
+
+#include
+
+/* NOTE: The size of this structure (32 ints) is known in
+ , since it is used in the `io_stat' RPC. MiG
+ does not cope at all well with the passed C structure not being of
+ the expected size. There are some filler words at the end to allow
+ for future expansion. To increase the size of the structure used
+ in the RPC and retain binary compatibility, we would need to assign
+ a new message number. */
+
+struct stat
+ {
+ int st_fstype; /* File system type. */
+ __fsid_t st_fsid; /* File system ID. */
+#define st_dev st_fsid
+
+#ifndef __USE_FILE_OFFSET64
+ __ino_t st_ino; /* File number. */
+#else
+ __ino64_t st_ino; /* File number. */
+#endif
+ unsigned int st_gen; /* To detect reuse of file numbers. */
+ __dev_t st_rdev; /* Device if special file. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Number of links. */
+
+ __uid_t st_uid; /* Owner. */
+ __gid_t st_gid; /* Owning group. */
+
+#ifndef __USE_FILE_OFFSET64
+ __off_t st_size; /* Size in bytes. */
+#else
+ __off64_t st_size; /* Size in bytes. */
+#endif
+
+#ifdef __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 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
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int st_atimensec; /* Nscecs of last access. */
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
+
+ __blksize_t st_blksize; /* Optimal size for I/O. */
+
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated.
+ Not related to `st_blksize'. */
+#else
+ __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
+ Not related to `st_blksize'. */
+#endif
+
+ __uid_t st_author; /* File author. */
+
+ unsigned int st_flags; /* User-defined flags.
+ High 16 bits can be set only by root. */
+
+#ifndef __USE_FILE_OFFSET64
+# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
+#else
+# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
+#endif
+ int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
+#undef _SPARE_SIZE
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ int st_fstype; /* File system type. */
+ __fsid_t st_fsid; /* File system ID. */
+# define st_dev st_fsid
+
+ __ino64_t st_ino; /* File number. */
+ unsigned int st_gen; /* To detect reuse of file numbers. */
+ __dev_t st_rdev; /* Device if special file. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Number of links. */
+
+ __uid_t st_uid; /* Owner. */
+ __gid_t st_gid; /* Owning group. */
+
+ __off64_t st_size; /* Size in bytes. */
+
+#ifdef __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 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
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int st_atimensec; /* Nscecs of last access. */
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
+
+ __blksize_t st_blksize; /* Optimal size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
+ Not related to `st_blksize'. */
+
+ __uid_t st_author; /* File author. */
+
+ unsigned int st_flags; /* User-defined flags.
+ High 16 bits can be set only by root. */
+
+#define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
+ int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
+#undef _SPARE_SIZE
+ };
+#endif
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+/* 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_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+#define __S_IFIFO 0010000 /* FIFO. */
+
+/* POSIX.1b objects. */
+#define __S_TYPEISMQ(buf) (0)
+#define __S_TYPEISSEM(buf) (0)
+#define __S_TYPEISSHM(buf) (0)
+
+/* 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 00400 /* Read by owner. */
+#define __S_IWRITE 00200 /* Write by owner. */
+#define __S_IEXEC 00100 /* Execute by owner. */
+
+
+#ifdef __USE_GNU
+/* If set, there is no benefit in caching the contents of this file. */
+#define S_INOCACHE 000000200000
+
+/* If the S_IUSEUNK bit is set, then the S_IUNKNOWN bits (see below)
+ control access for unknown users. If S_IUSEUNK is clear, then unknown
+ users are treated as "others" for purposes of access control. */
+#define S_IUSEUNK 000000400000
+/* Mask of protection bits for unknown users (no effective IDs at all). */
+#define S_IUNKNOWN 000007000000
+/* Shift S_IREAD, S_IWRITE, S_IEXEC left this many bits to produce the
+ protection bits for unknown users. */
+#define S_IUNKSHIFT 12
+
+/* Read only bits: */
+
+/* There is a passive translator set for this file */
+#define S_IPTRANS 000010000000
+/* There is an active translator running on this file */
+#define S_IATRANS 000020000000
+/* This is the root of a filesystem (or single node translator) */
+#define S_IROOT 000040000000
+/* All the bits relevant to translators */
+#define S_ITRANS 000070000000
+
+/* Definitely no mmaps to this. */
+#define S_IMMAP0 000100000000
+
+/* ALL the unused bits. */
+#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0| \
+ S_IUSEUNK|S_IUNKNOWN|07777))
+#endif
+
+#ifdef __USE_MISC
+/* Default file creation mask (umask). */
+# define CMASK 0022
+
+/* Definitions of flags stored in file flags word. */
+
+/* Super-user and owner changeable flags. */
+# define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */
+# define UF_NODUMP 0x00000001 /* do not dump file */
+# define UF_IMMUTABLE 0x00000002 /* file may not be changed */
+# define UF_APPEND 0x00000004 /* writes to file may only append */
+# define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
+# define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */
+
+/* Super-user changeable flags. */
+# define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */
+# define SF_ARCHIVED 0x00010000 /* file is archived */
+# define SF_IMMUTABLE 0x00020000 /* file may not be changed */
+# define SF_APPEND 0x00040000 /* writes to file may only append */
+# define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */
+# define SF_SNAPSHOT 0x00200000 /* snapshot inode */
+
+__BEGIN_DECLS
+
+/* Set file flags for FILE to FLAGS. */
+extern int chflags (__const char *__file, unsigned long int __flags) __THROW;
+
+/* Set file flags of the file referred to by FD to FLAGS. */
+extern int fchflags (int __fd, unsigned long int __flags) __THROW;
+
+__END_DECLS
+#endif
+
+#ifdef __USE_ATFILE
+# define UTIME_NOW -1 /* corresponds to the current time */
+# define UTIME_OMIT -2 /* target time is omitted */
+#endif
+
+#endif /* bits/stat.h */
diff --git a/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h b/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h
new file mode 100644
index 0000000000000000000000000000000000000000..6bd9b43599b69f343fcdf17e07fef8e98a52ebaf
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h
@@ -0,0 +1,68 @@
+/* bits/typesizes.h -- underlying types for *_t. Hurd version.
+ Copyright (C) 2002-2019 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
+ . */
+
+#ifndef _BITS_TYPES_H
+# error "Never include directly; use instead."
+#endif
+
+#ifndef _BITS_TYPESIZES_H
+#define _BITS_TYPESIZES_H 1
+
+/* See for the meaning of these macros. This file exists so
+ that need not vary across different GNU platforms. */
+
+#define __DEV_T_TYPE __U32_TYPE
+#define __UID_T_TYPE __U32_TYPE
+#define __GID_T_TYPE __U32_TYPE
+#define __INO_T_TYPE __ULONGWORD_TYPE
+#define __INO64_T_TYPE __UQUAD_TYPE
+#define __MODE_T_TYPE __U32_TYPE
+#define __NLINK_T_TYPE __UWORD_TYPE
+#define __OFF_T_TYPE __SLONGWORD_TYPE
+#define __OFF64_T_TYPE __SQUAD_TYPE
+#define __PID_T_TYPE __S32_TYPE
+#define __RLIM_T_TYPE __ULONGWORD_TYPE
+#define __RLIM64_T_TYPE __UQUAD_TYPE
+#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
+#define __BLKCNT64_T_TYPE __SQUAD_TYPE
+#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
+#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
+#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
+#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
+#define __FSWORD_T_TYPE __SWORD_TYPE
+#define __ID_T_TYPE __U32_TYPE
+#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+#define __TIME_T_TYPE __SLONGWORD_TYPE
+#define __USECONDS_T_TYPE __U32_TYPE
+#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __DADDR_T_TYPE __S32_TYPE
+#define __KEY_T_TYPE __S32_TYPE
+#define __CLOCKID_T_TYPE __S32_TYPE
+#define __TIMER_T_TYPE __S32_TYPE
+#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
+#define __FSID_T_TYPE __UQUAD_TYPE
+#define __SSIZE_T_TYPE __SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
+#define __CPU_MASK_TYPE __ULONGWORD_TYPE
+
+/* Number of descriptors that can fit in an `fd_set'. */
+#define __FD_SETSIZE 256
+
+
+#endif /* bits/typesizes.h */
diff --git a/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h b/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f329f53a92a5e8e2302c626cc13730cdd533ea4
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h
@@ -0,0 +1,31 @@
+/* System-specific settings for dynamic linker code. Hurd version.
+ Copyright (C) 2002-2019 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
+ . */
+
+/* The private errno doesn't make sense on the Hurd. errno is always the
+ thread-local slot shared with libc, and it matters to share the cell
+ with libc because after startup we use libc functions that set errno
+ (open, mmap, etc). */
+
+#define RTLD_PRIVATE_ERRNO 0
+
+#ifdef SHARED
+/* _dl_argv and __libc_stack_end cannot be attribute_relro, because the stack-switching
+ libc initializer for using cthreads might write into it. */
+# define DL_ARGV_NOT_RELRO 1
+# define LIBC_STACK_END_NOT_RELRO 1
+#endif
diff --git a/libc/glibc/sysdeps/mach/hurd/kernel-features.h b/libc/glibc/sysdeps/mach/hurd/kernel-features.h
new file mode 100644
index 0000000000000000000000000000000000000000..2c9c0acda232854aa1e605cdcfe8e4298bb06964
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/hurd/kernel-features.h
@@ -0,0 +1,21 @@
+/* Set flags signalling availability of certain operating system features.
+ Copyright (C) 2012-2019 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
+ . */
+
+/* This file can define __ASSUME_* macros checked by certain source files.
+ Almost none of these are used outside of sysdeps/unix/sysv/linux code.
+ But those referring to POSIX-level features like O_* flags can be. */
diff --git a/libc/glibc/sysdeps/mach/i386/sysdep.h b/libc/glibc/sysdeps/mach/i386/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..d55e4fcea83f1a7a0d6c31ddd85e4a23469ab274
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/i386/sysdep.h
@@ -0,0 +1,69 @@
+/* Copyright (C) 1991-2019 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
+ . */
+
+#ifndef _MACH_I386_SYSDEP_H
+#define _MACH_I386_SYSDEP_H 1
+
+/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */
+#include
+#include
+
+#define LOSE asm volatile ("hlt")
+
+#define SNARF_ARGS(entry_sp, argc, argv, envp) \
+ do \
+ { \
+ char **p; \
+ argc = (int) *entry_sp; \
+ argv = (char **) (entry_sp + 1); \
+ p = argv; \
+ while (*p++ != NULL) \
+ ; \
+ if (p >= (char **) argv[0]) \
+ --p; \
+ envp = p; \
+ } while (0)
+
+#define CALL_WITH_SP(fn, info, sp) \
+ do { \
+ void **ptr = (void **) sp; \
+ *--(__typeof (info) *) ptr = info; \
+ ptr[-1] = ptr; \
+ --ptr; \
+ asm volatile ("movl %0, %%esp; call %1" : : \
+ "g" (ptr), "m" (*(long int *) (fn)) : "%esp"); \
+ } while (0)
+
+#define RETURN_TO(sp, pc, retval) \
+ asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \
+ : : "g" (sp), "r" (pc), "a" (retval))
+
+
+#define STACK_GROWTH_DOWN
+
+/* Get the machine-independent Mach definitions. */
+#include
+
+
+/* This should be rearranged, but at the moment this file provides
+ the most useful definitions for assembler syntax details. */
+#undef ENTRY
+#undef ALIGN
+#include
+
+#endif /* mach/i386/sysdep.h */
diff --git a/libc/glibc/sysdeps/mach/libc-lock.h b/libc/glibc/sysdeps/mach/libc-lock.h
new file mode 100644
index 0000000000000000000000000000000000000000..e768973aca05bf65baa1864459b79b79a9b1a3a8
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/libc-lock.h
@@ -0,0 +1,230 @@
+/* libc-internal interface for mutex locks. Mach cthreads version.
+ Copyright (C) 1996-2019 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
+ . */
+
+#ifndef _LIBC_LOCK_H
+#define _LIBC_LOCK_H 1
+
+#ifdef _LIBC
+
+#include
+#include
+
+/* The locking here is very inexpensive, even for inlining. */
+#define _IO_lock_inexpensive 1
+
+typedef unsigned int __libc_lock_t;
+typedef struct
+{
+ __libc_lock_t lock;
+ int cnt;
+ void *owner;
+} __libc_lock_recursive_t;
+
+typedef __libc_lock_recursive_t __rtld_lock_recursive_t;
+
+extern char __libc_lock_self0[0];
+#define __libc_lock_owner_self() \
+ (__LIBC_NO_TLS () ? (void *)&__libc_lock_self0 : THREAD_SELF)
+
+#else
+typedef struct __libc_lock_opaque__ __libc_lock_t;
+typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
+#endif
+
+/* Define a lock variable NAME with storage class CLASS. The lock must be
+ initialized with __libc_lock_init before it can be used (or define it
+ with __libc_lock_define_initialized, below). Use `extern' for CLASS to
+ declare a lock defined in another module. In public structure
+ definitions you must use a pointer to the lock structure (i.e., NAME
+ begins with a `*'), because its storage size will not be known outside
+ of libc. */
+#define __libc_lock_define(CLASS,NAME) \
+ CLASS __libc_lock_t NAME;
+
+/* Define an initialized lock variable NAME with storage class CLASS. */
+#define _LIBC_LOCK_INITIALIZER LLL_INITIALIZER
+#define __libc_lock_define_initialized(CLASS,NAME) \
+ CLASS __libc_lock_t NAME = LLL_INITIALIZER;
+
+/* Initialize the named lock variable, leaving it in a consistent, unlocked
+ state. */
+#define __libc_lock_init(NAME) (NAME) = LLL_INITIALIZER
+
+/* Finalize the named lock variable, which must be locked. It cannot be
+ used again until __libc_lock_init is called again on it. This must be
+ called on a lock variable before the containing storage is reused. */
+#define __libc_lock_fini __libc_lock_unlock
+#define __libc_lock_fini_recursive __libc_lock_unlock_recursive
+#define __rtld_lock_fini_recursive __rtld_lock_unlock_recursive
+
+/* Lock the named lock variable. */
+#define __libc_lock_lock(NAME) \
+ ({ lll_lock (&(NAME), 0); 0; })
+
+/* Lock the named lock variable. */
+#define __libc_lock_trylock(NAME) lll_trylock (&(NAME))
+
+/* Unlock the named lock variable. */
+#define __libc_lock_unlock(NAME) \
+ ({ lll_unlock (&(NAME), 0); 0; })
+
+#define __libc_lock_define_recursive(CLASS,NAME) \
+ CLASS __libc_lock_recursive_t NAME;
+
+#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_INITIALIZER, 0, 0 }
+
+#define __libc_lock_define_initialized_recursive(CLASS,NAME) \
+ CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER;
+
+#define __rtld_lock_define_recursive(CLASS,NAME) \
+ __libc_lock_define_recursive (CLASS, NAME)
+#define _RTLD_LOCK_RECURSIVE_INITIALIZER \
+ _LIBC_LOCK_RECURSIVE_INITIALIZER
+#define __rtld_lock_define_initialized_recursive(CLASS,NAME) \
+ __libc_lock_define_initialized_recursive (CLASS, NAME)
+
+#define __libc_lock_init_recursive(NAME) \
+ ({ \
+ (NAME) = (__libc_lock_recursive_t)_LIBC_LOCK_RECURSIVE_INITIALIZER; \
+ 0; \
+ })
+
+#define __libc_lock_trylock_recursive(NAME) \
+ ({ \
+ __libc_lock_recursive_t *const __lock = &(NAME); \
+ void *__self = __libc_lock_owner_self (); \
+ int __r = 0; \
+ if (__self == __lock->owner) \
+ ++__lock->cnt; \
+ else if ((__r = lll_trylock (&__lock->lock)) == 0) \
+ __lock->owner = __self, __lock->cnt = 1; \
+ __r; \
+ })
+
+#define __libc_lock_lock_recursive(NAME) \
+ ({ \
+ __libc_lock_recursive_t *const __lock = &(NAME); \
+ void *__self = __libc_lock_owner_self (); \
+ if (__self != __lock->owner) \
+ { \
+ lll_lock (&__lock->lock, 0); \
+ __lock->owner = __self; \
+ } \
+ ++__lock->cnt; \
+ (void)0; \
+ })
+
+#define __libc_lock_unlock_recursive(NAME) \
+ ({ \
+ __libc_lock_recursive_t *const __lock = &(NAME); \
+ if (--__lock->cnt == 0) \
+ { \
+ __lock->owner = 0; \
+ lll_unlock (&__lock->lock, 0); \
+ } \
+ })
+
+
+#define __rtld_lock_initialize(NAME) \
+ (void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER)
+#define __rtld_lock_trylock_recursive(NAME) \
+ __libc_lock_trylock_recursive (NAME)
+#define __rtld_lock_lock_recursive(NAME) \
+ __libc_lock_lock_recursive(NAME)
+#define __rtld_lock_unlock_recursive(NAME) \
+ __libc_lock_unlock_recursive (NAME)
+
+/* XXX for now */
+#define __libc_rwlock_define __libc_lock_define
+#define __libc_rwlock_define_initialized __libc_lock_define_initialized
+#define __libc_rwlock_init __libc_lock_init
+#define __libc_rwlock_fini __libc_lock_fini
+#define __libc_rwlock_rdlock __libc_lock_lock
+#define __libc_rwlock_wrlock __libc_lock_lock
+#define __libc_rwlock_tryrdlock __libc_lock_trylock
+#define __libc_rwlock_trywrlock __libc_lock_trylock
+#define __libc_rwlock_unlock __libc_lock_unlock
+
+struct __libc_cleanup_frame
+{
+ void (*__fct) (void *);
+ void *__argp;
+ int __doit;
+};
+
+__extern_inline void
+__libc_cleanup_fct (struct __libc_cleanup_frame *framep)
+{
+ if (framep->__doit)
+ framep->__fct (framep->__argp);
+}
+
+/* Start a critical region with a cleanup function */
+#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
+ do \
+ { \
+ struct __libc_cleanup_frame __cleanup \
+ __attribute__ ((__cleanup__ (__libc_cleanup_fct))) = \
+ { .__fct = (FCT), .__argp = (ARG), .__doit = (DOIT) };
+
+/* This one closes the brace above. */
+#define __libc_cleanup_region_end(DOIT) \
+ __cleanup.__doit = (DOIT); \
+ } \
+ while (0)
+
+#define __libc_cleanup_end(DOIT) __cleanup.__doit = (DOIT);
+
+#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
+#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
+
+/* Use mutexes as once control variables. */
+
+struct __libc_once
+ {
+ __libc_lock_t lock;
+ int done;
+ };
+
+#define __libc_once_define(CLASS,NAME) \
+ CLASS struct __libc_once NAME = { _LIBC_LOCK_INITIALIZER, 0 }
+
+/* Call handler iff the first call. */
+#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+ do { \
+ __libc_lock_lock (ONCE_CONTROL.lock); \
+ if (!ONCE_CONTROL.done) \
+ (INIT_FUNCTION) (); \
+ ONCE_CONTROL.done = 1; \
+ __libc_lock_unlock (ONCE_CONTROL.lock); \
+ } while (0)
+
+/* Get once control variable. */
+#define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL).done != 0)
+
+#ifdef _LIBC
+/* We need portable names for some functions. E.g., when they are
+ used as argument to __libc_cleanup_region_start. */
+#define __libc_mutex_unlock __libc_lock_unlock
+
+/* Hide the definitions which are only supposed to be used inside libc in
+ a separate file. This file is not present in the installation! */
+# include
+#endif
+
+#endif /* libc-lock.h */
diff --git a/libc/glibc/sysdeps/mach/sys/syscall.h b/libc/glibc/sysdeps/mach/sys/syscall.h
new file mode 100644
index 0000000000000000000000000000000000000000..6e4ed4d64ecbfad25fb7f9bd684ccae933781c38
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/sys/syscall.h
@@ -0,0 +1 @@
+/* The Mach syscalls are in . */
diff --git a/libc/glibc/sysdeps/mach/sysdep.h b/libc/glibc/sysdeps/mach/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..fccfdb33e39523ac8eee443d4e9b075a20447b91
--- /dev/null
+++ b/libc/glibc/sysdeps/mach/sysdep.h
@@ -0,0 +1,86 @@
+/* Copyright (C) 1994-2019 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
+ . */
+
+#ifdef __ASSEMBLER__
+
+/* Get the Mach definitions of ENTRY and kernel_trap. */
+#include
+
+/* The Mach definitions assume underscores should be prepended to
+ symbol names. Redefine them to do so only when appropriate. */
+#undef EXT
+#undef LEXT
+#define EXT(x) C_SYMBOL_NAME(x)
+#define LEXT(x) C_SYMBOL_NAME(x##:)
+
+/* For ELF we need to add the `.type' directive to make shared libraries
+ work right. */
+#undef ENTRY
+#define ENTRY(name) \
+ .globl name; \
+ .align ALIGN; \
+ .type name,@function; \
+ name:
+
+#endif
+
+/* This is invoked by things run when there is random lossage, before they
+ try to do anything else. Just to be safe, deallocate the reply port so
+ bogons arriving on it don't foul up future RPCs. */
+
+#ifndef __ASSEMBLER__
+#define FATAL_PREPARE_INCLUDE
+#define FATAL_PREPARE __mig_dealloc_reply_port (MACH_PORT_NULL)
+#endif
+
+/* sysdeps/mach/MACHINE/sysdep.h should define the following macros. */
+
+/* Produce a text assembler label for the C global symbol NAME. */
+#ifndef ENTRY
+#define ENTRY(name) .error ENTRY not defined by sysdeps/mach/MACHINE/sysdep.h
+/* This is not used on all machines. */
+#endif
+
+/* Set variables ARGC, ARGV, and ENVP for the arguments
+ left on the stack by the microkernel. */
+#ifndef SNARF_ARGS
+#define SNARF_ARGS(argc, argv, envp)
+#error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h
+#endif
+
+/* Call the C function FN with no arguments,
+ on a stack starting at SP (as returned by *_cthread_init_routine).
+ You don't need to deal with FN returning; it shouldn't. */
+#ifndef CALL_WITH_SP
+#define CALL_WITH_SP(fn, sp)
+#error CALL_WITH_SP not defined by sysdeps/mach/MACHINE/sysdep.h
+#endif
+
+/* LOSE can be defined as the `halt' instruction or something
+ similar which will cause the process to die in a characteristic
+ way suggesting a bug. */
+#ifndef LOSE
+#define LOSE ({ volatile int zero = 0; zero / zero; })
+#endif
+
+/* One of these should be defined to specify the stack direction. */
+#if !defined (STACK_GROWTH_UP) && !defined (STACK_GROWTH_DOWN)
+#error stack direction unspecified
+#endif
+
+/* Used by some assembly code. */
+#define C_SYMBOL_NAME(name) name
diff --git a/libc/glibc/sysdeps/microblaze/bits/endian.h b/libc/glibc/sysdeps/microblaze/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..3650f3d564f2045ef7beb380489fe4c7c0c81da2
--- /dev/null
+++ b/libc/glibc/sysdeps/microblaze/bits/endian.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 1997-2019 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
+ . */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* MicroBlaze can be either big or little endian. */
+#ifdef _BIG_ENDIAN
+# define __BYTE_ORDER __BIG_ENDIAN
+# define __FLOAT_WORD_ORDER __BIG_ENDIAN
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# define __FLOAT_WORD_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/libc/glibc/sysdeps/microblaze/crti.S b/libc/glibc/sysdeps/microblaze/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..2a884ad1039704a6bd96fafa3982692d11bd52cd
--- /dev/null
+++ b/libc/glibc/sysdeps/microblaze/crti.S
@@ -0,0 +1,90 @@
+/* Special .init and .fini section support for MicroBlaze.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ addik r1,r1,-32
+ swi r20,r1,28
+ mfs r20,rpc
+ addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
+ lwi r3,r20,PREINIT_FUNCTION@GOT
+#if PREINIT_FUNCTION_WEAK
+ beqid r3,$Lno_weak_fn:
+ swi r15,r1,0
+ brlid r15,PREINIT_FUNCTION@PLT
+$Lno_weak_fn:
+#else
+ swi r15,r1,0
+ brald r15,r3
+#endif
+ nop # Unfilled delay slot
+
+ .section .fini,"ax",@progbits
+ .align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ addik r1,r1,-32
+ swi r20,r1,28
+ swi r15,r1,0
+ mfs r20,rpc
+ addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
diff --git a/libc/glibc/sysdeps/microblaze/crtn.S b/libc/glibc/sysdeps/microblaze/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..a6f0875a000a2f203c16643c167a491e7afb2eaa
--- /dev/null
+++ b/libc/glibc/sysdeps/microblaze/crtn.S
@@ -0,0 +1,51 @@
+/* Special .init and .fini section support for MicroBlaze.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+#include
+
+ .section .init,"ax",@progbits
+ lwi r15,r1,0
+ lwi r20,r1,28
+ rtsd r15,8
+ addik r1,r1,32
+
+ .section .fini,"ax",@progbits
+ lwi r15,r1,0
+ lwi r20,r1,28
+ rtsd r15,8
+ addik r1,r1,32
diff --git a/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..838e71f4e1454a6d8570fb09ea1fce441f471d99
--- /dev/null
+++ b/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,72 @@
+/* Copyright (C) 2002-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+# define _BITS_PTHREADTYPES_ARCH_H 1
+
+# include
+
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+# define __SIZEOF_PTHREAD_COND_T 48
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
+#define __PTHREAD_MUTEX_USE_UNION 1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+# else
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+# endif
+ int __cur_writer;
+};
+
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h. */
diff --git a/libc/glibc/sysdeps/microblaze/start.S b/libc/glibc/sysdeps/microblaze/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..0b60dab16ab7f734ae2a3212f977a2b4dac7fd8a
--- /dev/null
+++ b/libc/glibc/sysdeps/microblaze/start.S
@@ -0,0 +1,84 @@
+/* Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ /* On entry the stack contains the following args:
+ r1+0 - argc
+ r1+4 - argv[0]
+ ...
+ r1+4*(argc-1) - argv[argc-1]
+ r1+4*argc - NULL
+ r1+4*argc + 4 - envp[0]
+ ...
+ NULL
+ */
+ addk r3,r0,r0
+ addk r5,r1,r0
+1:
+ addik r5,r5,4
+ lw r4,r5,r0
+ bneid r4,1b
+ addik r3,r3,1
+ addik r6,r3,-1
+ sw r6,r1,r0
+ addik r7,r1,4
+ addik r1,r1,-24
+#ifdef SHARED
+ /* Setup PIC. */
+ mfs r20,rpc
+ addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
+ lwi r5,r20,main@GOT
+ lwi r8,r20,__libc_csu_init@GOT
+ lwi r9,r20,__libc_csu_fini@GOT
+ brid __libc_start_main@PLT
+ addk r10,r0,r0
+#else
+ addik r5,r0,main
+ addik r8,r0,__libc_csu_init
+ addik r9,r0,__libc_csu_fini
+ brid __libc_start_main
+ addk r10,r0,r0
+#endif
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/microblaze/sysdep.h b/libc/glibc/sysdeps/microblaze/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..baefe7a0286de6985f861708f35cb9c77a03e13a
--- /dev/null
+++ b/libc/glibc/sysdeps/microblaze/sysdep.h
@@ -0,0 +1,85 @@
+/* Copyright (C) 1997-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+# define ALIGNARG(log2) log2
+# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+/* Define an entry point visible from C. */
+# define ENTRY(name) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),@function; \
+ .align ALIGNARG(2); \
+ C_LABEL(name) \
+ CALL_MCOUNT
+
+# undef END
+# define END(name) ASM_SIZE_DIRECTIVE(name)
+
+
+/* If compiled for profiling, call `_mcount' at the start of each function. */
+# ifdef PROF
+/* The mcount code relies on a normal frame pointer being on the stack
+ to locate our caller, so push one just for its benefit. */
+# define CALL_MCOUNT \
+ addik r1,r1,-4; \
+ swi r15,r1,0; \
+ brlid r15,JUMPTARGET(mcount); \
+ nop; \
+ lwi r15,r1,0; \
+ addik r1,r1,4;
+# else
+# define CALL_MCOUNT /* Do nothing. */
+# endif
+
+/* Since C identifiers are not normally prefixed with an underscore
+ on this system, the asm identifier `syscall_error' intrudes on the
+ C name space. Make sure we use an innocuous name. */
+# define syscall_error __syscall_error
+# define mcount _mcount
+
+# define PSEUDO(name, syscall_name, args) \
+ .globl syscall_error; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args);
+
+# define ret \
+ rtsd r15,8; nop;
+
+# undef PSEUDO_END
+# define PSEUDO_END(name) \
+ END (name)
+
+# undef JUMPTARGET
+# ifdef PIC
+# define JUMPTARGET(name) name##@PLTPC
+# else
+# define JUMPTARGET(name) name
+# endif
+
+/* Local label name for asm code. */
+# ifndef L
+# define L(name) $L##name
+# endif
+
+# endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/mips/bits/endian.h b/libc/glibc/sysdeps/mips/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..126059799d781066c15c968a651179056861aa59
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/bits/endian.h
@@ -0,0 +1,15 @@
+/* The MIPS architecture has selectable endianness.
+ It exists in both little and big endian flavours and we
+ want to be able to share the installed header files between
+ both, so we define __BYTE_ORDER based on GCC's predefines. */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#ifdef __MIPSEB
+# define __BYTE_ORDER __BIG_ENDIAN
+#endif
+#ifdef __MIPSEL
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/libc/glibc/sysdeps/mips/dl-dtprocnum.h b/libc/glibc/sysdeps/mips/dl-dtprocnum.h
new file mode 100644
index 0000000000000000000000000000000000000000..3b490a34aac41594145eff80f033d8dc5e940699
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/dl-dtprocnum.h
@@ -0,0 +1,21 @@
+/* Configuration of lookup functions. MIPS version.
+ Copyright (C) 2000-2019 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
+ . */
+
+/* Number of extra dynamic section entries for this architecture. By
+ default there are none. */
+#define DT_THISPROCNUM DT_MIPS_NUM
diff --git a/libc/glibc/sysdeps/mips/mips32/crti.S b/libc/glibc/sysdeps/mips/mips32/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..7bdb9d12607b4da97a00ba2ede90d88551a45ffe
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/mips32/crti.S
@@ -0,0 +1,102 @@
+/* Special .init and .fini section support for MIPS (o32).
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+
+#ifdef __mips_micromips
+# define JALR_RELOC R_MICROMIPS_JALR
+#else
+# define JALR_RELOC R_MIPS_JALR
+#endif
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .set nomips16
+
+ .section .init,"ax",@progbits
+ .p2align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ .set noreorder
+ .cpload $25
+ .set reorder
+ addiu $sp,$sp,-32
+ .cprestore 16
+ sw $31,28($sp)
+#if PREINIT_FUNCTION_WEAK
+ lw $2,%got(PREINIT_FUNCTION)($28)
+ beq $2,$0,.Lno_weak_fn
+ lw $25,%call16(PREINIT_FUNCTION)($28)
+ .reloc 1f,JALR_RELOC,PREINIT_FUNCTION
+1: jalr $25
+.Lno_weak_fn:
+ .insn
+#else
+ lw $25,%got(PREINIT_FUNCTION)($28)
+ .reloc 1f,JALR_RELOC,PREINIT_FUNCTION
+1: jalr $25
+#endif
+
+ .section .fini,"ax",@progbits
+ .p2align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ .set noreorder
+ .cpload $25
+ .set reorder
+ addiu $sp,$sp,-32
+ .cprestore 16
+ sw $31,28($sp)
diff --git a/libc/glibc/sysdeps/mips/mips32/crtn.S b/libc/glibc/sysdeps/mips/mips32/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..0c110c00e67c9b4b363b7bde524025a1f7f44c97
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/mips32/crtn.S
@@ -0,0 +1,57 @@
+/* Special .init and .fini section support for MIPS (o32).
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .set nomips16
+
+ .section .init,"ax",@progbits
+ lw $31,28($sp)
+ .set noreorder
+ .set nomacro
+ j $31
+ addiu $sp,$sp,32
+ .set macro
+ .set reorder
+
+ .section .fini,"ax",@progbits
+ lw $31,28($sp)
+ .set noreorder
+ .set nomacro
+ j $31
+ addiu $sp,$sp,32
+ .set macro
+ .set reorder
diff --git a/libc/glibc/sysdeps/mips/mips64/n32/crti.S b/libc/glibc/sysdeps/mips/mips64/n32/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..5a6b1a0088f826dfbb9ab6e1423077d684d625a2
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/mips64/n32/crti.S
@@ -0,0 +1,102 @@
+/* Special .init and .fini section support for MIPS (n32).
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+
+#ifdef __mips_micromips
+# define JALR_RELOC R_MICROMIPS_JALR
+#else
+# define JALR_RELOC R_MIPS_JALR
+#endif
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .set nomips16
+
+ .section .init,"ax",@progbits
+ .p2align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ addiu $sp,$sp,-16
+ sd $28,0($sp)
+ lui $28,%hi(%neg(%gp_rel(_init)))
+ addu $28,$28,$25
+ sd $31,8($sp)
+ addiu $28,$28,%lo(%neg(%gp_rel(_init)))
+#if PREINIT_FUNCTION_WEAK
+ lw $2,%got_disp(PREINIT_FUNCTION)($28)
+ beq $2,$0,.Lno_weak_fn
+ lw $25,%call16(PREINIT_FUNCTION)($28)
+ .reloc 1f,JALR_RELOC,PREINIT_FUNCTION
+1: jalr $25
+.Lno_weak_fn:
+ .insn
+#else
+ lw $25,%got_disp(PREINIT_FUNCTION)($28)
+ .reloc 1f,JALR_RELOC,PREINIT_FUNCTION
+1: jalr $25
+#endif
+
+ .section .fini,"ax",@progbits
+ .p2align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ addiu $sp,$sp,-16
+ sd $28,0($sp)
+ lui $28,%hi(%neg(%gp_rel(_fini)))
+ addu $28,$28,$25
+ sd $31,8($sp)
+ addiu $28,$28,%lo(%neg(%gp_rel(_fini)))
diff --git a/libc/glibc/sysdeps/mips/mips64/n32/crtn.S b/libc/glibc/sysdeps/mips/mips64/n32/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..fad316e27f537640ec8ef1ae84dde05787141605
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/mips64/n32/crtn.S
@@ -0,0 +1,59 @@
+/* Special .init and .fini section support for MIPS (n32).
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .set nomips16
+
+ .section .init,"ax",@progbits
+ ld $31,8($sp)
+ ld $28,0($sp)
+ .set noreorder
+ .set nomacro
+ j $31
+ addiu $sp,$sp,16
+ .set macro
+ .set reorder
+
+ .section .fini,"ax",@progbits
+ ld $31,8($sp)
+ ld $28,0($sp)
+ .set noreorder
+ .set nomacro
+ j $31
+ addiu $sp,$sp,16
+ .set macro
+ .set reorder
diff --git a/libc/glibc/sysdeps/mips/mips64/n64/crti.S b/libc/glibc/sysdeps/mips/mips64/n64/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..43c49abc1df39d8c5460651cba3db22eb16d1d4c
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/mips64/n64/crti.S
@@ -0,0 +1,102 @@
+/* Special .init and .fini section support for MIPS (n64).
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+
+#ifdef __mips_micromips
+# define JALR_RELOC R_MICROMIPS_JALR
+#else
+# define JALR_RELOC R_MIPS_JALR
+#endif
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .set nomips16
+
+ .section .init,"ax",@progbits
+ .p2align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ daddiu $sp,$sp,-16
+ sd $28,0($sp)
+ lui $28,%hi(%neg(%gp_rel(_init)))
+ daddu $28,$28,$25
+ sd $31,8($sp)
+ daddiu $28,$28,%lo(%neg(%gp_rel(_init)))
+#if PREINIT_FUNCTION_WEAK
+ ld $2,%got_disp(PREINIT_FUNCTION)($28)
+ beq $2,$0,.Lno_weak_fn
+ ld $25,%call16(PREINIT_FUNCTION)($28)
+ .reloc 1f,JALR_RELOC,PREINIT_FUNCTION
+1: jalr $25
+.Lno_weak_fn:
+ .insn
+#else
+ ld $25,%got_disp(PREINIT_FUNCTION)($28)
+ .reloc 1f,JALR_RELOC,PREINIT_FUNCTION
+1: jalr $25
+#endif
+
+ .section .fini,"ax",@progbits
+ .p2align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ daddiu $sp,$sp,-16
+ sd $28,0($sp)
+ lui $28,%hi(%neg(%gp_rel(_fini)))
+ daddu $28,$28,$25
+ sd $31,8($sp)
+ daddiu $28,$28,%lo(%neg(%gp_rel(_fini)))
diff --git a/libc/glibc/sysdeps/mips/mips64/n64/crtn.S b/libc/glibc/sysdeps/mips/mips64/n64/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..d6870d18b298b295472fc076113d91edb175379a
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/mips64/n64/crtn.S
@@ -0,0 +1,59 @@
+/* Special .init and .fini section support for MIPS (n64).
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .set nomips16
+
+ .section .init,"ax",@progbits
+ ld $31,8($sp)
+ ld $28,0($sp)
+ .set noreorder
+ .set nomacro
+ j $31
+ daddiu $sp,$sp,16
+ .set macro
+ .set reorder
+
+ .section .fini,"ax",@progbits
+ ld $31,8($sp)
+ ld $28,0($sp)
+ .set noreorder
+ .set nomacro
+ j $31
+ daddiu $sp,$sp,16
+ .set macro
+ .set reorder
diff --git a/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..bebee00258e744b6656915974dd5540ff3bc647a
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,89 @@
+/* Machine-specific pthread type layouts. MIPS version.
+ Copyright (C) 2005-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#if _MIPS_SIM == _ABI64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (_MIPS_SIM != _ABI64)
+#define __PTHREAD_MUTEX_USE_UNION (_MIPS_SIM != _ABI64)
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if _MIPS_SIM == _ABI64
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned int __flags;
+# else
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+# else
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+# endif
+ int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/mips/start.S b/libc/glibc/sysdeps/mips/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..8638e5b545603510849da4f7dced25e4cf541712
--- /dev/null
+++ b/libc/glibc/sysdeps/mips/start.S
@@ -0,0 +1,185 @@
+/* Startup code compliant to the ELF Mips ABI.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+#define __ASSEMBLY__ 1
+#include
+#include
+#include
+
+#ifndef ENTRY_POINT
+#error ENTRY_POINT needs to be defined for start.S on MIPS/ELF.
+#endif
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment. The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry
+ point runs, most registers' values are unspecified, except for:
+
+ v0 ($2) Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ sp ($29) The stack contains the arguments and environment:
+ 0(%esp) argc
+ 4(%esp) argv[0]
+ ...
+ (4*argc)(%esp) NULL
+ (4*(argc+1))(%esp) envp[0]
+ ...
+ NULL
+ ra ($31) The return address register is set to zero so that programs
+ that search backword through stack frames recognize the last
+ stack frame.
+*/
+
+
+/* We need to call:
+ __libc_start_main (int (*main) (int, char **, char **), int argc,
+ char **argv, void (*init) (void), void (*fini) (void),
+ void (*rtld_fini) (void), void *stack_end)
+*/
+
+ .text
+ .globl ENTRY_POINT
+ .type ENTRY_POINT,@function
+#ifndef __mips16
+ENTRY_POINT:
+# ifdef __PIC__
+ SETUP_GPX($0)
+ SETUP_GPX64($25,$0)
+# else
+ PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */
+ move $31, $0
+# endif
+
+ PTR_LA $4, main /* main */
+ PTR_L $5, 0($29) /* argc */
+ PTR_ADDIU $6, $29, PTRSIZE /* argv */
+
+ /* Allocate space on the stack for seven arguments (o32 only)
+ and make sure the stack is aligned to double words (8 bytes)
+ on o32 and quad words (16 bytes) on n32 and n64. */
+
+ and $29, -2 * SZREG
+# if _MIPS_SIM == _ABIO32
+ PTR_SUBIU $29, 32
+# endif
+ PTR_LA $7, __libc_csu_init /* init */
+ PTR_LA $8, __libc_csu_fini
+# if _MIPS_SIM == _ABIO32
+ PTR_S $8, 16($29) /* fini */
+ PTR_S $2, 20($29) /* rtld_fini */
+ PTR_S $29, 24($29) /* stack_end */
+# else
+ move $9, $2 /* rtld_fini */
+ move $10, $29 /* stack_end */
+# endif
+ PTR_LA $25, __libc_start_main
+ jalr $25
+hlt: b hlt /* Crash if somehow it does return. */
+
+#elif _MIPS_SIM == _ABIO32 /* __mips16 */
+ /* MIPS16 entry point. */
+ .set mips16
+ENTRY_POINT:
+# ifdef __PIC__
+ li $3, %hi(_gp_disp)
+ addiu $4, $pc, %lo(_gp_disp)
+ sll $3, 16
+ addu $3, $4
+ move $gp, $3
+# else
+ li $3, %hi(_gp)
+ sll $3, 16
+ addiu $3, %lo(_gp)
+ move $gp, $3
+# endif
+ /* Tie end of stack frames. */
+ li $4, 0
+ move $31, $4
+ /* Create new SP value in $7, including alignment. */
+ li $4, 2 * SZREG
+ neg $4, $4
+ move $7, $sp
+ and $7, $4
+ addiu $7, -32
+ /* Load arguments with original SP. */
+ lw $5, 0($sp)
+ addiu $6, $sp, PTRSIZE
+ /* Update SP. */
+ move $sp, $7
+ /* Lay out last arguments, and call __libc_start_main(). */
+# ifdef __PIC__
+ sw $7, 24($sp) /* stack_end */
+ lw $4, %got(__libc_csu_fini)($3)
+ lw $7, %got(__libc_csu_init)($3) /* init */
+ sw $4, 16($sp) /* fini */
+ lw $4, %got(main)($3) /* main */
+ lw $3, %call16(__libc_start_main)($3)
+ sw $2, 20($sp) /* rtld_fini */
+ move $25, $3
+ jalr $3
+# else
+ lw $4, 1f
+ sw $7, 24($sp) /* stack_end */
+ lw $7, 2f /* init */
+ sw $4, 16($sp) /* fini */
+ lw $4, 3f /* main */
+ sw $2, 20($sp) /* rtld_fini */
+ /* Load and call __libc_start_main(). */
+ lw $3, 4f
+ jalr $3
+# endif
+hlt: b hlt /* Crash if somehow it does return. */
+# ifndef __PIC__
+ .align 2
+1: .word __libc_csu_fini
+2: .word __libc_csu_init
+3: .word main
+4: .word __libc_start_main
+# endif
+
+#else /* __mips16 && _MIPS_SIM != _ABIO32 */
+# error "MIPS16 support for N32/N64 not implemented"
+
+#endif /* __mips16 */
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/nios2/bits/endian.h b/libc/glibc/sysdeps/nios2/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..164f9e4d785c16f3ff90f0ecf92f8e70dbef796c
--- /dev/null
+++ b/libc/glibc/sysdeps/nios2/bits/endian.h
@@ -0,0 +1,12 @@
+/* The Nios II architecture has selectable endianness. */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#ifdef __nios2_big_endian__
+# define __BYTE_ORDER __BIG_ENDIAN
+#endif
+#ifdef __nios2_little_endian__
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/libc/glibc/sysdeps/nios2/crti.S b/libc/glibc/sysdeps/nios2/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..68087f60f928ba4bb2251870cdb220d7b44108cb
--- /dev/null
+++ b/libc/glibc/sysdeps/nios2/crti.S
@@ -0,0 +1,98 @@
+/* Special .init and .fini section support for Nios II.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .align 2
+ .global _init
+ .hidden _init
+ .type _init, @function
+_init:
+ addi sp, sp, -8
+ stw r22, 0(sp)
+ nextpc r22
+ 1:
+ movhi r8, %hiadj(_gp_got - 1b)
+ addi r8, r8, %lo(_gp_got - 1b)
+ add r22, r22, r8
+ stw ra, 4(sp)
+#if PREINIT_FUNCTION_WEAK
+ movhi r2, %got_hiadj(PREINIT_FUNCTION)
+ addi r2, r2, %got_lo(PREINIT_FUNCTION)
+ add r2, r2, r22
+ ldw r2, 0(r2)
+ beq r2, zero, .L5
+#endif
+ movhi r2, %call_hiadj(PREINIT_FUNCTION)
+ addi r2, r2, %call_lo(PREINIT_FUNCTION)
+ add r2, r2, r22
+ ldw r2, 0(r2)
+ callr r2
+.L5:
+
+ .section .fini,"ax",@progbits
+ .align 2
+ .global _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ addi sp, sp, -8
+ stw r22, 0(sp)
+ nextpc r22
+ 1:
+ movhi r8, %hiadj(_gp_got - 1b)
+ addi r8, r8, %lo(_gp_got - 1b)
+ stw ra, 4(sp)
+ add r22, r22, r8
diff --git a/libc/glibc/sysdeps/nios2/crtn.S b/libc/glibc/sysdeps/nios2/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..de35607100e3827b0a0db950c283c0bcb52b0804
--- /dev/null
+++ b/libc/glibc/sysdeps/nios2/crtn.S
@@ -0,0 +1,49 @@
+/* Special .init and .fini section support for Nios II.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",@progbits
+ ldw ra, 4(sp)
+ ldw r22, 0(sp)
+ addi sp, sp, 8
+ ret
+
+ .section .fini,"ax",@progbits
+ ldw ra, 4(sp)
+ ldw r22, 0(sp)
+ addi sp, sp, 8
+ ret
diff --git a/libc/glibc/sysdeps/nios2/dl-sysdep.h b/libc/glibc/sysdeps/nios2/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..f27770e2bbd2d0949f4755c5a502c377be211800
--- /dev/null
+++ b/libc/glibc/sysdeps/nios2/dl-sysdep.h
@@ -0,0 +1,25 @@
+/* System-specific settings for dynamic linker code. Nios II version.
+ Copyright (C) 2009-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
+
+#define DL_EXTERN_PROTECTED_DATA
diff --git a/libc/glibc/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..1091e63eaceec9c49a15d7c3ca2e4e24270d02e9
--- /dev/null
+++ b/libc/glibc/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,72 @@
+/* Machine-specific pthread type layouts. Nios II version.
+ Copyright (C) 2012-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 32
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
+#define __PTHREAD_MUTEX_USE_UNION 1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+#else
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/nios2/start.S b/libc/glibc/sysdeps/nios2/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..e5e14a02fdbfbd9b289ea05946572b1ac2a71c7e
--- /dev/null
+++ b/libc/glibc/sysdeps/nios2/start.S
@@ -0,0 +1,146 @@
+/* Startup code for Nios II
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment.
+
+ Note that the code in the .init section has already been run.
+ This includes _init and _libc_init
+
+ The stack pointer, sp, will point to the argument count on the stack.
+ The initial state of the stack when a userspace process is started is:
+
+ Purpose Start Address Length
+ Unspecified High Addresses
+ Referenced strings, etc. Varies
+ Unspecified
+ Null auxilliary vector entry 4bytes
+ Auxilliary vector entries 8bytes each
+ NULL terminator for envp 4bytes
+ Environment pointers sp+8+4*argc 4bytes each
+ NULL terminator for argv sp+4+4*argc 4bytes
+ Argument pointers sp+4 4bytes each
+ Argument count sp 4bytes
+ Unspecified Low Addresses
+
+ If the application should register a destructor function with atexit,
+ the pointer will be placed in r4. Otherwise r4 will be zero.
+
+ The contents of all other registers are unspecified. User code should
+ set fp to zero to mark the end of the frame chain.
+
+ The auxilliary vector is a series of pairs of 32-bit tag and 32-bit
+ value, terminated by an AT_NULL tag.
+*/
+
+ .text
+ .globl _start
+ .type _start,%function
+_start:
+ /* Set up the global pointer. */
+ movhi gp, %hiadj(_gp)
+ addi gp, gp, %lo(_gp)
+
+ /* Save the stack pointer. */
+ mov r2, sp
+
+ /* Create room on the stack for the fini, rtld_fini and stack_end args
+ to __libc_start_main. */
+ subi sp, sp, 12
+
+ /* Push stack_end */
+ stw r2, 8(sp)
+
+ /* Push rtld_fini */
+ stw r4, 4(sp)
+
+ /* Set up the GOT pointer. */
+ nextpc r22
+1: movhi r2, %hiadj(_gp_got - 1b)
+ addi r2, r2, %lo(_gp_got - 1b)
+ add r22, r22, r2
+
+ /* Push fini */
+ movhi r8, %call_hiadj(__libc_csu_fini)
+ addi r8, r8, %call_lo(__libc_csu_fini)
+ add r8, r8, r22
+ ldw r8, 0(r8)
+ stw r8, 0(sp)
+
+ /* r7 == init */
+ movhi r7, %call_hiadj(__libc_csu_init)
+ addi r7, r7, %call_lo(__libc_csu_init)
+ add r7, r7, r22
+ ldw r7, 0(r7)
+
+ /* r6 == argv */
+ addi r6, sp, 16
+
+ /* r5 == argc */
+ ldw r5, 12(sp)
+
+ /* r4 == main */
+ movhi r4, %call_hiadj(main)
+ addi r4, r4, %call_lo(main)
+ add r4, r4, r22
+ ldw r4, 0(r4)
+
+ /* fp == 0 */
+ mov fp, zero
+
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
+ stack_end) */
+
+ /* Let the libc call main and exit with its return code. */
+ movhi r2, %call_hiadj(__libc_start_main)
+ addi r2, r2, %call_lo(__libc_start_main)
+ add r2, r2, r22
+ ldw r2, 0(r2)
+ callr r2
+
+ /* should never get here....*/
+ movhi r2, %call_hiadj(abort)
+ addi r2, r2, %call_lo(abort)
+ add r2, r2, r22
+ ldw r2, 0(r2)
+ callr r2
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/nios2/sysdep.h b/libc/glibc/sysdeps/nios2/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e95241e22115115db985e5fc3e2c318f6785177
--- /dev/null
+++ b/libc/glibc/sysdeps/nios2/sysdep.h
@@ -0,0 +1,65 @@
+/* Assembler macros for Nios II.
+ Copyright (C) 2015-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+#define ENTRY(name) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),%function; \
+ C_LABEL(name) \
+ cfi_startproc; \
+ CALL_MCOUNT;
+
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ ASM_SIZE_DIRECTIVE(name)
+
+#ifdef PROF
+
+# ifdef __PIC__
+# define CALL_MCOUNT \
+ mov r8, ra; \
+ nextpc r2; \
+1: \
+ movhi r3, %hiadj(_gp_got - 1b); \
+ addi r3, r3, %lo(_gp_got - 1b); \
+ add r2, r2, r3; \
+ ldw r2, %call(_mcount)(r2); \
+ callr r2; \
+ mov ra, r8; \
+ ret;
+# else
+# define CALL_MCOUNT \
+ mov r8, ra; \
+ call _mount; \
+ mov ra, r8; \
+ ret;
+# endif
+
+#else
+# define CALL_MCOUNT /* Do nothing. */
+#endif
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/nptl/lowlevellock.h b/libc/glibc/sysdeps/nptl/lowlevellock.h
deleted file mode 100644
index 36bbc472e7466c6d28562e95d28cb8a79962977c..0000000000000000000000000000000000000000
--- a/libc/glibc/sysdeps/nptl/lowlevellock.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Low-level lock implementation. Generic futex-based version.
- Copyright (C) 2005-2019 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
- . */
-
-#ifndef _LOWLEVELLOCK_H
-#define _LOWLEVELLOCK_H 1
-
-#include
-#include
-
-/* Low-level locks use a combination of atomic operations (to acquire and
- release lock ownership) and futex operations (to block until the state
- of a lock changes). A lock can be in one of three states:
- 0: not acquired,
- 1: acquired with no waiters; no other threads are blocked or about to block
- for changes to the lock state,
- >1: acquired, possibly with waiters; there may be other threads blocked or
- about to block for changes to the lock state.
-
- We expect that the common case is an uncontended lock, so we just need
- to transition the lock between states 0 and 1; releasing the lock does
- not need to wake any other blocked threads. If the lock is contended
- and a thread decides to block using a futex operation, then this thread
- needs to first change the state to >1; if this state is observed during
- lock release, the releasing thread will wake one of the potentially
- blocked threads.
-
- Much of this code takes a 'private' parameter. This may be:
- LLL_PRIVATE: lock only shared within a process
- LLL_SHARED: lock may be shared across processes.
-
- Condition variables contain an optimization for broadcasts that requeues
- waiting threads on a lock's futex. Therefore, there is a special
- variant of the locks (whose name contains "cond") that makes sure to
- always set the lock state to >1 and not just 1.
-
- Robust locks set the lock to the id of the owner. This allows detection
- of the case where the owner exits without releasing the lock. Flags are
- OR'd with the owner id to record additional information about lock state.
- Therefore the states of robust locks are:
- 0: not acquired
- id: acquired (by user identified by id & FUTEX_TID_MASK)
-
- The following flags may be set in the robust lock value:
- FUTEX_WAITERS - possibly has waiters
- FUTEX_OWNER_DIED - owning user has exited without releasing the futex. */
-
-
-/* If LOCK is 0 (not acquired), set to 1 (acquired with no waiters) and return
- 0. Otherwise leave lock unchanged and return non-zero to indicate that the
- lock was not acquired. */
-#define lll_trylock(lock) \
- __glibc_unlikely (atomic_compare_and_exchange_bool_acq (&(lock), 1, 0))
-
-/* If LOCK is 0 (not acquired), set to 2 (acquired, possibly with waiters) and
- return 0. Otherwise leave lock unchanged and return non-zero to indicate
- that the lock was not acquired. */
-#define lll_cond_trylock(lock) \
- __glibc_unlikely (atomic_compare_and_exchange_bool_acq (&(lock), 2, 0))
-
-extern void __lll_lock_wait_private (int *futex) attribute_hidden;
-extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
-
-/* This is an expression rather than a statement even though its value is
- void, so that it can be used in a comma expression or as an expression
- that's cast to void. */
-/* The inner conditional compiles to a call to __lll_lock_wait_private if
- private is known at compile time to be LLL_PRIVATE, and to a call to
- __lll_lock_wait otherwise. */
-/* If FUTEX is 0 (not acquired), set to 1 (acquired with no waiters) and
- return. Otherwise, ensure that it is >1 (acquired, possibly with waiters)
- and then block until we acquire the lock, at which point FUTEX will still be
- >1. The lock is always acquired on return. */
-#define __lll_lock(futex, private) \
- ((void) \
- ({ \
- int *__futex = (futex); \
- if (__glibc_unlikely \
- (atomic_compare_and_exchange_bool_acq (__futex, 1, 0))) \
- { \
- if (__builtin_constant_p (private) && (private) == LLL_PRIVATE) \
- __lll_lock_wait_private (__futex); \
- else \
- __lll_lock_wait (__futex, private); \
- } \
- }))
-#define lll_lock(futex, private) \
- __lll_lock (&(futex), private)
-
-
-/* This is an expression rather than a statement even though its value is
- void, so that it can be used in a comma expression or as an expression
- that's cast to void. */
-/* Unconditionally set FUTEX to 2 (acquired, possibly with waiters). If FUTEX
- was 0 (not acquired) then return. Otherwise, block until the lock is
- acquired, at which point FUTEX is 2 (acquired, possibly with waiters). The
- lock is always acquired on return. */
-#define __lll_cond_lock(futex, private) \
- ((void) \
- ({ \
- int *__futex = (futex); \
- if (__glibc_unlikely (atomic_exchange_acq (__futex, 2) != 0)) \
- __lll_lock_wait (__futex, private); \
- }))
-#define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
-
-
-extern int __lll_timedlock_wait (int *futex, const struct timespec *,
- int private) attribute_hidden;
-
-
-/* As __lll_lock, but with a timeout. If the timeout occurs then return
- ETIMEDOUT. If ABSTIME is invalid, return EINVAL. */
-#define __lll_timedlock(futex, abstime, private) \
- ({ \
- int *__futex = (futex); \
- int __val = 0; \
- \
- if (__glibc_unlikely \
- (atomic_compare_and_exchange_bool_acq (__futex, 1, 0))) \
- __val = __lll_timedlock_wait (__futex, abstime, private); \
- __val; \
- })
-#define lll_timedlock(futex, abstime, private) \
- __lll_timedlock (&(futex), abstime, private)
-
-
-/* This is an expression rather than a statement even though its value is
- void, so that it can be used in a comma expression or as an expression
- that's cast to void. */
-/* Unconditionally set FUTEX to 0 (not acquired), releasing the lock. If FUTEX
- was >1 (acquired, possibly with waiters), then wake any waiters. The waiter
- that acquires the lock will set FUTEX to >1.
- Evaluate PRIVATE before releasing the lock so that we do not violate the
- mutex destruction requirements. Specifically, we need to ensure that
- another thread can destroy the mutex (and reuse its memory) once it
- acquires the lock and when there will be no further lock acquisitions;
- thus, we must not access the lock after releasing it, or those accesses
- could be concurrent with mutex destruction or reuse of the memory. */
-#define __lll_unlock(futex, private) \
- ((void) \
- ({ \
- int *__futex = (futex); \
- int __private = (private); \
- int __oldval = atomic_exchange_rel (__futex, 0); \
- if (__glibc_unlikely (__oldval > 1)) \
- lll_futex_wake (__futex, 1, __private); \
- }))
-#define lll_unlock(futex, private) \
- __lll_unlock (&(futex), private)
-
-
-#define lll_islocked(futex) \
- ((futex) != LLL_LOCK_INITIALIZER)
-
-
-/* Our internal lock implementation is identical to the binary-compatible
- mutex implementation. */
-
-/* Initializers for lock. */
-#define LLL_LOCK_INITIALIZER (0)
-#define LLL_LOCK_INITIALIZER_LOCKED (1)
-
-extern int __lll_timedwait_tid (int *, const struct timespec *)
- attribute_hidden;
-
-/* The kernel notifies a process which uses CLONE_CHILD_CLEARTID via futex
- wake-up when the clone terminates. The memory location contains the
- thread ID while the clone is running and is reset to zero by the kernel
- afterwards. The kernel up to version 3.16.3 does not use the private futex
- operations for futex wake-up when the clone terminates.
- If ABSTIME is not NULL, is used a timeout for futex call. If the timeout
- occurs then return ETIMEOUT, if ABSTIME is invalid, return EINVAL.
- The futex operation are issues with cancellable versions. */
-#define lll_wait_tid(tid, abstime) \
- ({ \
- int __res = 0; \
- __typeof (tid) __tid; \
- if (abstime != NULL) \
- __res = __lll_timedwait_tid (&(tid), (abstime)); \
- else \
- /* We need acquire MO here so that we synchronize with the \
- kernel's store to 0 when the clone terminates. (see above) */ \
- while ((__tid = atomic_load_acquire (&(tid))) != 0) \
- lll_futex_wait_cancel (&(tid), __tid, LLL_SHARED); \
- __res; \
- })
-
-
-#endif /* lowlevellock.h */
diff --git a/libc/glibc/sysdeps/powerpc/bits/endian.h b/libc/glibc/sysdeps/powerpc/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd8ae4fc50cf2cf81929844a9223bfc00b2e0768
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/bits/endian.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997-2019 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
+ . */
+
+/* PowerPC can be little or big endian. Hopefully gcc will know... */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
+# endif
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# else
+# warning Cannot determine current byte order, assuming big-endian.
+# define __BYTE_ORDER __BIG_ENDIAN
+# endif
+#endif
diff --git a/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..e91c8cda8ee1b643a41ee0d093ae31ef574c9231
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,81 @@
+/* Machine-specific pthread type layouts. PowerPC version.
+ Copyright (C) 2003-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 1
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
+#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if __WORDSIZE == 64
+ int __cur_writer;
+ int __shared;
+ unsigned char __rwelision;
+ unsigned char __pad1[7];
+ unsigned long int __pad2;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned int __flags;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
+#else
+ unsigned char __rwelision;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ int __cur_writer;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+#endif
+};
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/powerpc/powerpc32/crti.S b/libc/glibc/sysdeps/powerpc/powerpc32/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..6c54dcb7b04c67210d48fdbc117edb44415bd5f4
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc32/crti.S
@@ -0,0 +1,91 @@
+/* Special .init and .fini section support for PowerPC.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ stwu r1, -16(r1)
+ mflr r0
+ stw r0, 20(r1)
+ stw r30, 8(r1)
+ SETUP_GOT_ACCESS (r30, .Lgot_label_i)
+ addis r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@ha
+ addi r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@l
+#if PREINIT_FUNCTION_WEAK
+ lwz r0, PREINIT_FUNCTION@got(r30)
+ cmpwi cr7, r0, 0
+ beq+ cr7, 1f
+ bl PREINIT_FUNCTION@plt
+1:
+#else
+ bl PREINIT_FUNCTION@local
+#endif
+
+ .section .fini,"ax",@progbits
+ .align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ stwu r1, -16(r1)
+ mflr r0
+ stw r0, 20(r1)
+ stw r30, 8(r1)
+ SETUP_GOT_ACCESS (r30, .Lgot_label_f)
diff --git a/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S b/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..aa933c9bb54ef678af989b0c52833b55f2f3604d
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S
@@ -0,0 +1,53 @@
+/* Special .init and .fini section support for PowerPC.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+#include
+
+ .section .init,"ax",@progbits
+ lwz r0, 20(r1)
+ mtlr r0
+ lwz r30, 8(r1)
+ addi r1, r1, 16
+ blr
+
+ .section .fini,"ax",@progbits
+ lwz r0, 20(r1)
+ mtlr r0
+ lwz r30, 8(r1)
+ addi r1, r1, 16
+ blr
diff --git a/libc/glibc/sysdeps/powerpc/powerpc32/dl-dtprocnum.h b/libc/glibc/sysdeps/powerpc/powerpc32/dl-dtprocnum.h
new file mode 100644
index 0000000000000000000000000000000000000000..7fe2be793911a568aacc2ab1c3b5511c7a5d37fe
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc32/dl-dtprocnum.h
@@ -0,0 +1,3 @@
+/* Number of extra dynamic section entries for this architecture. By
+ default there are none. */
+#define DT_THISPROCNUM DT_PPC_NUM
diff --git a/libc/glibc/sysdeps/powerpc/powerpc32/start.S b/libc/glibc/sysdeps/powerpc/powerpc32/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..172fb5a56be665e77d601eeb8bc1b31024ea4cd1
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc32/start.S
@@ -0,0 +1,95 @@
+/* Startup code for programs linked with GNU libc.
+ Copyright (C) 1998-2019 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.
+
+ 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
+ . */
+
+#include
+
+/* We do not want .eh_frame info for crt1.o since crt1.o is linked
+ before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */
+#undef cfi_startproc
+#define cfi_startproc
+#undef cfi_endproc
+#define cfi_endproc
+
+ /* These are the various addresses we require. */
+#ifdef PIC
+ .section ".data"
+#else
+ .section ".rodata"
+#endif
+ .align 2
+L(start_addresses):
+ .long _SDA_BASE_
+ .long main
+ .long __libc_csu_init
+ .long __libc_csu_fini
+ ASM_SIZE_DIRECTIVE(L(start_addresses))
+
+ .section ".text"
+ENTRY(_start)
+ /* Save the stack pointer, in case we're statically linked under Linux. */
+ mr r9,r1
+ /* Set up an initial stack frame, and clear the LR. */
+ clrrwi r1,r1,4
+#ifdef PIC
+ SETUP_GOT_ACCESS(r13,got_label)
+ li r0,0
+#else
+ li r0,0
+#endif
+ stwu r1,-16(r1)
+ mtlr r0
+ stw r0,0(r1)
+ /* Set r13 to point at the 'small data area', and put the address of
+ start_addresses in r8. Also load the GOT pointer so that new PLT
+ calls work, like the one to __libc_start_main. */
+#ifdef PIC
+ addis r30,r13,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addis r8,r13,L(start_addresses)-got_label@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l
+ lwzu r13, L(start_addresses)-got_label@l(r8)
+#else
+ lis r8,L(start_addresses)@ha
+ lwzu r13,L(start_addresses)@l(r8)
+#endif
+ /* and continue in libc-start, in glibc. */
+ b JUMPTARGET(__libc_start_main)
+END(_start)
+
+/* Define a symbol for the first piece of initialized data. */
+ .section ".data"
+ .globl __data_start
+__data_start:
+ .long 0
+weak_alias (__data_start, data_start)
diff --git a/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h b/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..1937c5082b9b920e22ec84032d824dc96b4d0023
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h
@@ -0,0 +1,21 @@
+/* Hacks needed for symbol manipulation. powerpc version.
+ Copyright (C) 2017-2019 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
+ . */
+
+#include
+
+#include_next "symbol-hacks.h"
diff --git a/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h b/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d431f56cdac86b271a6f448dc898792e83e0813
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h
@@ -0,0 +1,160 @@
+/* Assembly macros for 32-bit PowerPC.
+ Copyright (C) 1999-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* If compiled for profiling, call `_mcount' at the start of each
+ function. */
+#ifdef PROF
+/* The mcount code relies on a the return address being on the stack
+ to locate our caller and so it can restore it; so store one just
+ for its benefit. */
+# define CALL_MCOUNT \
+ mflr r0; \
+ stw r0,4(r1); \
+ cfi_offset (lr, 4); \
+ bl JUMPTARGET(_mcount);
+#else /* PROF */
+# define CALL_MCOUNT /* Do nothing. */
+#endif /* PROF */
+
+#define ENTRY(name) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),@function; \
+ .align ALIGNARG(2); \
+ C_LABEL(name) \
+ cfi_startproc; \
+ CALL_MCOUNT
+
+#define ENTRY_TOCLESS(name) ENTRY(name)
+
+/* helper macro for accessing the 32-bit powerpc GOT. */
+
+#define SETUP_GOT_ACCESS(regname,GOT_LABEL) \
+ bcl 20,31,GOT_LABEL ; \
+GOT_LABEL: ; \
+ mflr (regname)
+
+#define EALIGN_W_0 /* No words to insert. */
+#define EALIGN_W_1 nop
+#define EALIGN_W_2 nop;nop
+#define EALIGN_W_3 nop;nop;nop
+#define EALIGN_W_4 EALIGN_W_3;nop
+#define EALIGN_W_5 EALIGN_W_4;nop
+#define EALIGN_W_6 EALIGN_W_5;nop
+#define EALIGN_W_7 EALIGN_W_6;nop
+
+/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
+ past a 2^align boundary. */
+#ifdef PROF
+# define EALIGN(name, alignt, words) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),@function; \
+ .align ALIGNARG(2); \
+ C_LABEL(name) \
+ cfi_startproc; \
+ CALL_MCOUNT \
+ b 0f; \
+ .align ALIGNARG(alignt); \
+ EALIGN_W_##words; \
+ 0:
+#else /* PROF */
+# define EALIGN(name, alignt, words) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),@function; \
+ .align ALIGNARG(alignt); \
+ EALIGN_W_##words; \
+ C_LABEL(name) \
+ cfi_startproc;
+#endif
+
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ ASM_SIZE_DIRECTIVE(name)
+
+#define DO_CALL(syscall) \
+ li 0,syscall; \
+ sc
+
+#undef JUMPTARGET
+#ifdef PIC
+# define JUMPTARGET(name) name##@plt
+#else
+# define JUMPTARGET(name) name
+#endif
+
+#if defined SHARED && defined PIC && !defined NO_HIDDEN
+# undef HIDDEN_JUMPTARGET
+# define HIDDEN_JUMPTARGET(name) __GI_##name##@local
+#endif
+
+#define PSEUDO(name, syscall_name, args) \
+ .section ".text"; \
+ ENTRY (name) \
+ DO_CALL (SYS_ify (syscall_name));
+
+#define PSEUDO_RET \
+ bnslr+; \
+ b __syscall_error@local
+#define ret PSEUDO_RET
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) \
+ END (name)
+
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .section ".text"; \
+ ENTRY (name) \
+ DO_CALL (SYS_ify (syscall_name));
+
+#define PSEUDO_RET_NOERRNO \
+ blr
+#define ret_NOERRNO PSEUDO_RET_NOERRNO
+
+#undef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(name) \
+ END (name)
+
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .section ".text"; \
+ ENTRY (name) \
+ DO_CALL (SYS_ify (syscall_name));
+
+#define PSEUDO_RET_ERRVAL \
+ blr
+#define ret_ERRVAL PSEUDO_RET_ERRVAL
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(name) \
+ END (name)
+
+/* Local labels stripped out by the linker. */
+#undef L
+#define L(x) .L##x
+
+#define XGLUE(a,b) a##b
+#define GLUE(a,b) XGLUE (a,b)
+#define GENERATE_GOT_LABEL(name) GLUE (.got_label, name)
+
+/* Label in text section. */
+#define C_TEXT(name) name
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/powerpc/powerpc64/crti.S b/libc/glibc/sysdeps/powerpc/powerpc64/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..52e294dcbd3df5341ff008bb971ee8013b78ef45
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc64/crti.S
@@ -0,0 +1,90 @@
+/* Special .init and .fini section support for PowerPC64.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ .section ".toc", "aw"
+.LC0:
+ .tc PREINIT_FUNCTION[TC], PREINIT_FUNCTION
+#endif
+ .section ".init", "ax", @progbits
+ ENTRY_2(_init)
+ .hidden _init
+ .align ALIGNARG (2)
+BODY_LABEL (_init):
+ LOCALENTRY(_init)
+ mflr 0
+ std 0, FRAME_LR_SAVE(r1)
+ stdu r1, -FRAME_MIN_SIZE_PARM(r1)
+#if PREINIT_FUNCTION_WEAK
+ addis r9, r2, .LC0@toc@ha
+ ld r0, .LC0@toc@l(r9)
+ cmpdi cr7, r0, 0
+ beq+ cr7, 1f
+#endif
+ bl JUMPTARGET (PREINIT_FUNCTION)
+ nop
+1:
+
+ .section ".fini", "ax", @progbits
+ ENTRY_2(_fini)
+ .hidden _fini
+ .align ALIGNARG (2)
+BODY_LABEL (_fini):
+ LOCALENTRY(_fini)
+ mflr 0
+ std 0, FRAME_LR_SAVE(r1)
+ stdu r1, -FRAME_MIN_SIZE_PARM(r1)
diff --git a/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S b/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..32ace21c5b6924d225e26237c2d22b2a16d6837d
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S
@@ -0,0 +1,51 @@
+/* Special .init and .fini section support for PowerPC64.
+ Copyright (C) 2012-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+#include
+
+ .section .init,"ax",@progbits
+ addi r1, r1, FRAME_MIN_SIZE_PARM
+ ld r0, FRAME_LR_SAVE(r1)
+ mtlr r0
+ blr
+
+ .section .fini,"ax",@progbits
+ addi r1, r1, FRAME_MIN_SIZE_PARM
+ ld r0, FRAME_LR_SAVE(r1)
+ mtlr r0
+ blr
diff --git a/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h b/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6756e6a4c5d480aaa758272a7cca6306628718b
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h
@@ -0,0 +1,21 @@
+/* Configuration of lookup functions. PowerPC64 version.
+ Copyright (C) 2002-2019 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
+ . */
+
+/* Number of extra dynamic section entries for this architecture. By
+ default there are none. */
+#define DT_THISPROCNUM DT_PPC64_NUM
diff --git a/libc/glibc/sysdeps/powerpc/powerpc64/start.S b/libc/glibc/sysdeps/powerpc/powerpc64/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..55fae68ad6d167d0380ac955ae805812daa3f56c
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc64/start.S
@@ -0,0 +1,92 @@
+/* Startup code for programs linked with GNU libc. PowerPC64 version.
+ Copyright (C) 1998-2019 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.
+
+ 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
+ . */
+
+#include
+
+/* We do not want .eh_frame info for crt1.o since crt1.o is linked
+ before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */
+#undef cfi_startproc
+#define cfi_startproc
+#undef cfi_endproc
+#define cfi_endproc
+
+ /* These are the various addresses we require. */
+#ifdef PIC
+ .section ".data.rel.ro.local","aw"
+#else
+ .section ".rodata"
+#endif
+ .align 3
+L(start_addresses):
+ .quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
+/* function descriptors so don't need JUMPTARGET */
+ .quad main
+ .quad __libc_csu_init
+ .quad __libc_csu_fini
+
+ ASM_SIZE_DIRECTIVE(L(start_addresses))
+
+ .section ".toc","aw"
+.L01:
+ .tc L(start_addresses)[TC],L(start_addresses)
+ .section ".text"
+ENTRY (_start)
+ /* Save the stack pointer, in case we're statically linked under Linux. */
+ mr r9,r1
+ /* Set up an initial stack frame, and clear the LR. */
+ clrrdi r1,r1,4
+ li r0,0
+ stdu r1,-128(r1)
+ mtlr r0
+ std r0,0(r1)
+
+ /* put the address of start_addresses in r8... **
+** PPC64 ABI uses R13 for thread local, so we leave it alone */
+ ld r8,.L01@toc(r2)
+
+ /* and continue in libc-start, in glibc. */
+ b JUMPTARGET(__libc_start_main)
+/* Older versions of ld need this nop to recognize that it's OK to call via a
+ TOC adjusting stub. */
+ nop
+
+END(_start)
+
+/* Define a symbol for the first piece of initialized data. */
+ .section ".data"
+ .globl __data_start
+__data_start:
+ .long 0
+weak_alias (__data_start, data_start)
diff --git a/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h b/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..08772d34a2bc433198c0c6329435b56930f743ae
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h
@@ -0,0 +1,400 @@
+/* Assembly macros for 64-bit PowerPC.
+ Copyright (C) 2002-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Stack frame offsets. */
+#define FRAME_BACKCHAIN 0
+#define FRAME_CR_SAVE 8
+#define FRAME_LR_SAVE 16
+#if _CALL_ELF != 2
+#define FRAME_MIN_SIZE 112
+#define FRAME_MIN_SIZE_PARM 112
+#define FRAME_TOC_SAVE 40
+#define FRAME_PARM_SAVE 48
+#else
+#define FRAME_MIN_SIZE 32
+#define FRAME_MIN_SIZE_PARM 96
+#define FRAME_TOC_SAVE 24
+#define FRAME_PARM_SAVE 32
+#endif
+
+/* Support macros for CALL_MCOUNT. */
+ .macro SAVE_ARG NARG
+ .if \NARG
+ SAVE_ARG \NARG-1
+ std 2+\NARG,-FRAME_MIN_SIZE_PARM+FRAME_PARM_SAVE-8+8*(\NARG)(1)
+ .endif
+ .endm
+
+ .macro REST_ARG NARG
+ .if \NARG
+ REST_ARG \NARG-1
+ ld 2+\NARG,FRAME_PARM_SAVE-8+8*(\NARG)(1)
+ .endif
+ .endm
+
+ .macro CFI_SAVE_ARG NARG
+ .if \NARG
+ CFI_SAVE_ARG \NARG-1
+ cfi_offset(2+\NARG,-FRAME_MIN_SIZE_PARM+FRAME_PARM_SAVE-8+8*(\NARG))
+ .endif
+ .endm
+
+ .macro CFI_REST_ARG NARG
+ .if \NARG
+ CFI_REST_ARG \NARG-1
+ cfi_restore(2+\NARG)
+ .endif
+ .endm
+
+/* If compiled for profiling, call `_mcount' at the start of each function.
+ see ppc-mcount.S for more details. */
+ .macro CALL_MCOUNT NARG
+#ifdef PROF
+ mflr r0
+ SAVE_ARG \NARG
+ std r0,FRAME_LR_SAVE(r1)
+ stdu r1,-FRAME_MIN_SIZE_PARM(r1)
+ cfi_adjust_cfa_offset(FRAME_MIN_SIZE_PARM)
+ cfi_offset(lr,FRAME_LR_SAVE)
+ CFI_SAVE_ARG \NARG
+ bl JUMPTARGET (_mcount)
+#ifndef SHARED
+ nop
+#endif
+ ld r0,FRAME_MIN_SIZE_PARM+FRAME_LR_SAVE(r1)
+ REST_ARG \NARG
+ mtlr r0
+ addi r1,r1,FRAME_MIN_SIZE_PARM
+ cfi_adjust_cfa_offset(-FRAME_MIN_SIZE_PARM)
+ cfi_restore(lr)
+ CFI_REST_ARG \NARG
+#endif
+ .endm
+
+#if _CALL_ELF != 2
+
+/* Macro to prepare for calling via a function pointer. */
+ .macro PPC64_LOAD_FUNCPTR PTR
+ ld r12,0(\PTR)
+ ld r2,8(\PTR)
+ mtctr r12
+ ld r11,16(\PTR)
+ .endm
+
+#ifdef USE_PPC64_OVERLAPPING_OPD
+# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase
+#else
+# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase, 0
+#endif
+
+#define ENTRY_1(name) \
+ .type BODY_LABEL(name),@function; \
+ .globl name; \
+ .section ".opd","aw"; \
+ .p2align 3;FUNC_LABEL(name): \
+ OPD_ENT (name); \
+ .previous
+
+#define FUNC_LABEL(X) X
+#define BODY_LABEL(X) .LY##X
+#define ENTRY_2(name) \
+ .type name,@function; \
+ ENTRY_1(name)
+#define END_2(name) \
+ .size name,.-BODY_LABEL(name); \
+ .size BODY_LABEL(name),.-BODY_LABEL(name)
+#define LOCALENTRY(name)
+
+#else /* _CALL_ELF == 2 */
+
+/* Macro to prepare for calling via a function pointer. */
+ .macro PPC64_LOAD_FUNCPTR PTR
+ mr r12,\PTR
+ mtctr r12
+ .endm
+
+#define FUNC_LABEL(X) X
+#define BODY_LABEL(X) X
+#define ENTRY_2(name) \
+ .globl name; \
+ .type name,@function
+#define END_2(name) \
+ .size name,.-name
+#define LOCALENTRY(name) \
+1: addis r2,r12,.TOC.-1b@ha; \
+ addi r2,r2,.TOC.-1b@l; \
+ .localentry name,.-name
+
+#endif /* _CALL_ELF */
+
+ .macro NOPS NARG
+ .if \NARG
+ NOPS \NARG-1
+ nop
+ .endif
+ .endm
+
+ .macro ENTRY_3 name, alignp2=2, nopwords=0
+ .text
+ ENTRY_2(\name)
+ .p2align \alignp2
+ NOPS \nopwords
+BODY_LABEL(\name):
+ .endm
+
+/* Use ENTRY_TOCLESS for functions that make no use of r2 and
+ guarantee r2 is unchanged on exit. Any function that has @toc or
+ @got relocs uses r2. Functions that call other functions via the
+ PLT use r2. Use ENTRY for functions that may use or change r2.
+ The first argument is the function name.
+ The optional second argument specifies alignment of the function's
+ code, as the logarithm base two of the byte alignment. For
+ example, a value of four aligns to a sixteen byte boundary.
+ The optional third argument specifies the number of NOPs to emit
+ before the start of the function's code. */
+#ifndef PROF
+#define ENTRY_TOCLESS(name, ...) \
+ ENTRY_3 name, ## __VA_ARGS__; \
+ cfi_startproc
+
+#define ENTRY(name, ...) \
+ ENTRY_TOCLESS(name, ## __VA_ARGS__); \
+ LOCALENTRY(name)
+#else
+/* The call to _mcount is potentially via the plt, so profiling code
+ is never free of an r2 use. */
+#define ENTRY_TOCLESS(name, ...) \
+ ENTRY_3 name, ## __VA_ARGS__; \
+ cfi_startproc; \
+ LOCALENTRY(name)
+
+#define ENTRY(name, ...) \
+ ENTRY_TOCLESS(name, ## __VA_ARGS__)
+#endif
+
+/* Local labels stripped out by the linker. */
+#undef L
+#define L(x) .L##x
+
+#define tostring(s) #s
+#define stringify(s) tostring(s)
+#define XGLUE(a,b) a##b
+#define GLUE(a,b) XGLUE(a,b)
+#define LT_LABEL(name) GLUE(.LT,name)
+#define LT_LABELSUFFIX(name,suffix) GLUE(GLUE(.LT,name),suffix)
+
+/* Support Traceback tables */
+#define TB_ASM 0x000c000000000000
+#define TB_GLOBALLINK 0x0000800000000000
+#define TB_IS_EPROL 0x0000400000000000
+#define TB_HAS_TBOFF 0x0000200000000000
+#define TB_INT_PROC 0x0000100000000000
+#define TB_HAS_CTL 0x0000080000000000
+#define TB_TOCLESS 0x0000040000000000
+#define TB_FP_PRESENT 0x0000020000000000
+#define TB_LOG_ABORT 0x0000010000000000
+#define TB_INT_HANDL 0x0000008000000000
+#define TB_NAME_PRESENT 0x0000004000000000
+#define TB_USES_ALLOCA 0x0000002000000000
+#define TB_SAVES_CR 0x0000000200000000
+#define TB_SAVES_LR 0x0000000100000000
+#define TB_STORES_BC 0x0000000080000000
+#define TB_FIXUP 0x0000000040000000
+#define TB_FP_SAVED(fprs) (((fprs) & 0x3f) << 24)
+#define TB_GPR_SAVED(gprs) (((fprs) & 0x3f) << 16)
+#define TB_FIXEDPARMS(parms) (((parms) & 0xff) << 8)
+#define TB_FLOATPARMS(parms) (((parms) & 0x7f) << 1)
+#define TB_PARMSONSTK 0x0000000000000001
+
+#define PPC_HIGHER(v) (((v) >> 32) & 0xffff)
+#define TB_DEFAULT TB_ASM | TB_HAS_TBOFF | TB_NAME_PRESENT
+
+#define TRACEBACK(name) \
+LT_LABEL(name): ; \
+ .long 0 ; \
+ .quad TB_DEFAULT ; \
+ .long LT_LABEL(name)-BODY_LABEL(name) ; \
+ .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \
+LT_LABELSUFFIX(name,_name_start): ;\
+ .ascii stringify(name) ; \
+LT_LABELSUFFIX(name,_name_end): ; \
+ .p2align 2
+
+#define TRACEBACK_MASK(name,mask) \
+LT_LABEL(name): ; \
+ .long 0 ; \
+ .quad TB_DEFAULT | mask ; \
+ .long LT_LABEL(name)-BODY_LABEL(name) ; \
+ .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \
+LT_LABELSUFFIX(name,_name_start): ;\
+ .ascii stringify(name) ; \
+LT_LABELSUFFIX(name,_name_end): ; \
+ .p2align 2
+
+/* END generates Traceback tables */
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ TRACEBACK(name); \
+ END_2(name)
+
+/* This form supports more informative traceback tables */
+#define END_GEN_TB(name,mask) \
+ cfi_endproc; \
+ TRACEBACK_MASK(name,mask); \
+ END_2(name)
+
+#define DO_CALL(syscall) \
+ li 0,syscall; \
+ sc
+
+/* ppc64 is always PIC */
+#undef JUMPTARGET
+#define JUMPTARGET(name) FUNC_LABEL(name)
+
+#define PSEUDO(name, syscall_name, args) \
+ .section ".text"; \
+ ENTRY (name); \
+ DO_CALL (SYS_ify (syscall_name))
+
+#ifdef SHARED
+#define TAIL_CALL_SYSCALL_ERROR \
+ b JUMPTARGET(__syscall_error)
+#else
+/* Static version might be linked into a large app with a toc exceeding
+ 64k. We can't put a toc adjusting stub on a plain branch, so can't
+ tail call __syscall_error. */
+#define TAIL_CALL_SYSCALL_ERROR \
+ .ifdef .Local_syscall_error; \
+ b .Local_syscall_error; \
+ .else; \
+.Local_syscall_error: \
+ mflr 0; \
+ std 0,FRAME_LR_SAVE(1); \
+ stdu 1,-FRAME_MIN_SIZE(1); \
+ cfi_adjust_cfa_offset(FRAME_MIN_SIZE); \
+ cfi_offset(lr,FRAME_LR_SAVE); \
+ bl JUMPTARGET(__syscall_error); \
+ nop; \
+ ld 0,FRAME_MIN_SIZE+FRAME_LR_SAVE(1); \
+ addi 1,1,FRAME_MIN_SIZE; \
+ cfi_adjust_cfa_offset(-FRAME_MIN_SIZE); \
+ mtlr 0; \
+ cfi_restore(lr); \
+ blr; \
+ .endif
+#endif
+
+#define PSEUDO_RET \
+ bnslr+; \
+ TAIL_CALL_SYSCALL_ERROR
+
+#define ret PSEUDO_RET
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) \
+ END (name)
+
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .section ".text"; \
+ ENTRY (name); \
+ DO_CALL (SYS_ify (syscall_name))
+
+#define PSEUDO_RET_NOERRNO \
+ blr
+
+#define ret_NOERRNO PSEUDO_RET_NOERRNO
+
+#undef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(name) \
+ END (name)
+
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .section ".text"; \
+ ENTRY (name); \
+ DO_CALL (SYS_ify (syscall_name))
+
+#define PSEUDO_RET_ERRVAL \
+ blr
+
+#define ret_ERRVAL PSEUDO_RET_ERRVAL
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(name) \
+ END (name)
+
+#else /* !__ASSEMBLER__ */
+
+#if _CALL_ELF != 2
+
+#define PPC64_LOAD_FUNCPTR(ptr) \
+ "ld 12,0(" #ptr ")\n" \
+ "ld 2,8(" #ptr ")\n" \
+ "mtctr 12\n" \
+ "ld 11,16(" #ptr ")"
+
+#ifdef USE_PPC64_OVERLAPPING_OPD
+# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase"
+#else
+# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase, 0"
+#endif
+
+#define ENTRY_1(name) \
+ ".type " BODY_PREFIX #name ",@function\n" \
+ ".globl " #name "\n" \
+ ".pushsection \".opd\",\"aw\"\n" \
+ ".p2align 3\n" \
+#name ":\n" \
+ OPD_ENT (name) "\n" \
+ ".popsection"
+
+#define DOT_PREFIX ""
+#define BODY_PREFIX ".LY"
+#define ENTRY_2(name) \
+ ".type " #name ",@function\n" \
+ ENTRY_1(name)
+#define END_2(name) \
+ ".size " #name ",.-" BODY_PREFIX #name "\n" \
+ ".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name
+#define LOCALENTRY(name)
+
+#else /* _CALL_ELF */
+
+#define PPC64_LOAD_FUNCPTR(ptr) \
+ "mr 12," #ptr "\n" \
+ "mtctr 12"
+
+#define DOT_PREFIX ""
+#define BODY_PREFIX ""
+#define ENTRY_2(name) \
+ ".type " #name ",@function\n" \
+ ".globl " #name
+#define END_2(name) \
+ ".size " #name ",.-" #name
+#define LOCALENTRY(name) \
+ "1: addis 2,12,.TOC.-1b@ha\n" \
+ "addi 2,2,.TOC.-1b@l\n" \
+ ".localentry " #name ",.-" #name
+
+#endif /* _CALL_ELF */
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/powerpc/sysdep.h b/libc/glibc/sysdeps/powerpc/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..78f1155b02e68c2533a3c89ef867c54546935fc8
--- /dev/null
+++ b/libc/glibc/sysdeps/powerpc/sysdep.h
@@ -0,0 +1,167 @@
+/* Copyright (C) 1999-2019 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
+ . */
+
+/*
+ * Powerpc Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP).
+ * This entry is copied to _dl_hwcap or rtld_global._dl_hwcap during startup.
+ */
+#define _SYSDEPS_SYSDEP_H 1
+#include
+
+#define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
+
+#ifdef __ASSEMBLER__
+
+/* Symbolic names for the registers. The only portable way to write asm
+ code is to use number but this produces really unreadable code.
+ Therefore these symbolic names. */
+
+/* Integer registers. */
+#define r0 0
+#define r1 1
+#define r2 2
+#define r3 3
+#define r4 4
+#define r5 5
+#define r6 6
+#define r7 7
+#define r8 8
+#define r9 9
+#define r10 10
+#define r11 11
+#define r12 12
+#define r13 13
+#define r14 14
+#define r15 15
+#define r16 16
+#define r17 17
+#define r18 18
+#define r19 19
+#define r20 20
+#define r21 21
+#define r22 22
+#define r23 23
+#define r24 24
+#define r25 25
+#define r26 26
+#define r27 27
+#define r28 28
+#define r29 29
+#define r30 30
+#define r31 31
+
+/* Floating-point registers. */
+#define fp0 0
+#define fp1 1
+#define fp2 2
+#define fp3 3
+#define fp4 4
+#define fp5 5
+#define fp6 6
+#define fp7 7
+#define fp8 8
+#define fp9 9
+#define fp10 10
+#define fp11 11
+#define fp12 12
+#define fp13 13
+#define fp14 14
+#define fp15 15
+#define fp16 16
+#define fp17 17
+#define fp18 18
+#define fp19 19
+#define fp20 20
+#define fp21 21
+#define fp22 22
+#define fp23 23
+#define fp24 24
+#define fp25 25
+#define fp26 26
+#define fp27 27
+#define fp28 28
+#define fp29 29
+#define fp30 30
+#define fp31 31
+
+/* Condition code registers. */
+#define cr0 0
+#define cr1 1
+#define cr2 2
+#define cr3 3
+#define cr4 4
+#define cr5 5
+#define cr6 6
+#define cr7 7
+
+/* Vector registers. */
+#define v0 0
+#define v1 1
+#define v2 2
+#define v3 3
+#define v4 4
+#define v5 5
+#define v6 6
+#define v7 7
+#define v8 8
+#define v9 9
+#define v10 10
+#define v11 11
+#define v12 12
+#define v13 13
+#define v14 14
+#define v15 15
+#define v16 16
+#define v17 17
+#define v18 18
+#define v19 19
+#define v20 20
+#define v21 21
+#define v22 22
+#define v23 23
+#define v24 24
+#define v25 25
+#define v26 26
+#define v27 27
+#define v28 28
+#define v29 29
+#define v30 30
+#define v31 31
+
+#define VRSAVE 256
+
+/* The 32-bit words of a 64-bit dword are at these offsets in memory. */
+#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define LOWORD 0
+# define HIWORD 4
+#else
+# define LOWORD 4
+# define HIWORD 0
+#endif
+
+/* The high 16-bit word of a 64-bit dword is at this offset in memory. */
+#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define HISHORT 6
+#else
+# define HISHORT 0
+#endif
+
+/* This seems to always be the case on PPC. */
+#define ALIGNARG(log2) log2
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/pthread/allocalim.h b/libc/glibc/sysdeps/pthread/allocalim.h
deleted file mode 100644
index 8ac2e5d5be05640d426d08c0c9c0cfc85752b523..0000000000000000000000000000000000000000
--- a/libc/glibc/sysdeps/pthread/allocalim.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Determine whether block of given size can be allocated on the stack or not.
- Copyright (C) 2002-2019 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; see the file COPYING.LIB. If
- not, see . */
-
-#include
-#include
-
-
-extern __always_inline
-int
-__libc_use_alloca (size_t size)
-{
- return (__glibc_likely (__libc_alloca_cutoff (size))
-#ifdef PTHREAD_STACK_MIN
- || __glibc_likely (size <= PTHREAD_STACK_MIN / 4)
-#endif
- );
-}
diff --git a/libc/glibc/sysdeps/riscv/bits/endian.h b/libc/glibc/sysdeps/riscv/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..4aaf559d4f43cafe4c217629c6842d6abd00eb4c
--- /dev/null
+++ b/libc/glibc/sysdeps/riscv/bits/endian.h
@@ -0,0 +1,5 @@
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..e3fecc320825e23ea02412070ee3822e93806a3f
--- /dev/null
+++ b/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,68 @@
+/* Machine-specific pthread type layouts. RISC-V version.
+ Copyright (C) 2011-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#if __riscv_xlen == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+# define __SIZEOF_PTHREAD_COND_T 48
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#else
+# error "rv32i-based systems are not supported"
+#endif
+
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_USE_UNION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+/* There is a lot of padding in this structure. While it's not strictly
+ necessary on RISC-V, we're going to leave it in to be on the safe side in
+ case it's needed in the future. Most other architectures have the padding,
+ so this gives us the same extensibility as everyone else has. */
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/riscv/start.S b/libc/glibc/sysdeps/riscv/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..e2fb99d8ed5afddae3253bae079b605b8a281ff3
--- /dev/null
+++ b/libc/glibc/sysdeps/riscv/start.S
@@ -0,0 +1,86 @@
+/* Startup code compliant to the ELF RISC-V ABI.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+#define __ASSEMBLY__ 1
+#include
+#include
+#include
+
+/* The entry point's job is to call __libc_start_main. Per the ABI,
+ a0 contains the address of a function to be passed to atexit.
+ __libc_start_main wants this in a5. */
+
+ENTRY (ENTRY_POINT)
+ /* Terminate call stack by noting ra is undefined. Use a dummy
+ .cfi_label to force starting the FDE. */
+ .cfi_label .Ldummy
+ cfi_undefined (ra)
+ 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, __libc_csu_init
+ lla a4, __libc_csu_fini
+ mv a6, sp /* stack_end. */
+
+ call __libc_start_main@plt
+ ebreak
+END (ENTRY_POINT)
+
+/* 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/glibc/sysdeps/s390/bits/endian.h b/libc/glibc/sysdeps/s390/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..ac27f0119a8bb68ad7d80b4db96529c084299476
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/bits/endian.h
@@ -0,0 +1,7 @@
+/* s390 is big-endian */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..9629ea8be1d57f06d184ae5b5d2da87f34925383
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,79 @@
+/* Copyright (C) 2003-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 1
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
+#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if __WORDSIZE == 64
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned int __flags;
+# else
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/s390/s390-32/crti.S b/libc/glibc/sysdeps/s390/s390-32/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..372adb5df6e3b7ed4369a2f68edbaa1140a45933
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-32/crti.S
@@ -0,0 +1,104 @@
+/* Special .init and .fini section support for S/390.
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .globl _init
+ .hidden _init
+ .type _init,@function
+ .align 4
+_init:
+ stm %r6,%r15,24(%r15)
+ bras %r13,1f
+0:
+#if PREINIT_FUNCTION_WEAK
+ .long PREINIT_FUNCTION@GOT
+#else
+ .long PREINIT_FUNCTION-0b
+#endif
+ .long _GLOBAL_OFFSET_TABLE_-0b
+1: lr %r1,%r15
+ ahi %r15,-96
+ st %r1,0(%r15)
+ l %r12,4(%r13)
+ ar %r12,%r13
+ l %r1,0(%r13)
+#if PREINIT_FUNCTION_WEAK
+ l %r1,0(%r1,%r12)
+ ltr %r1,%r1
+ je 2f
+#else
+ la %r1,0(%r1,%r13)
+#endif
+ basr %r14,%r1
+ .align 4,0x07
+2:
+
+ .section .fini,"ax",@progbits
+ .globl _fini
+ .hidden _fini
+ .type _fini,@function
+ .align 4
+_fini:
+ stm %r6,%r15,24(%r15)
+ bras %r13,1f
+0: .long _GLOBAL_OFFSET_TABLE_-0b
+1: lr %r1,%r15
+ ahi %r15,-96
+ st %r1,0(%r15)
+ l %r12,0(%r13)
+ ar %r12,%r13
+ .align 4,0x07
diff --git a/libc/glibc/sysdeps/s390/s390-32/crtn.S b/libc/glibc/sysdeps/s390/s390-32/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..c912cb3553845acc71cb3af68122e3f891333f1f
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-32/crtn.S
@@ -0,0 +1,47 @@
+/* Special .init and .fini section support for S/390.
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",@progbits
+ l %r4,152(%r15)
+ lm %r6,%r15,120(%r15)
+ br %r4
+
+ .section .fini,"ax",@progbits
+ l %r4,152(%r15)
+ lm %r6,%r15,120(%r15)
+ br %r4
diff --git a/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h b/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6d66939ef4c2df2e0e6cb396cf7ed8054cb3ba3
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h
@@ -0,0 +1,23 @@
+/* System-specific settings for dynamic linker code. S/390 version.
+ Copyright (C) 2014-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
diff --git a/libc/glibc/sysdeps/s390/s390-32/start.S b/libc/glibc/sysdeps/s390/s390-32/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..c5bef71cec4102e61cf7fbd6c0ea830a68d7146e
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-32/start.S
@@ -0,0 +1,218 @@
+/* Startup code compliant to the ELF s390 ABI.
+ Copyright (C) 2000-2019 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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.
+
+ 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
+ . */
+
+#include
+
+/*
+ This is the canonical entry point, usually the first thing in the text
+ segment. Most registers' values are unspecified, except for:
+
+ %r14 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ %r15 The stack contains the arguments and environment:
+ 0(%r15) argc
+ 4(%r15) argv[0]
+ ...
+ (4*argc)(%r15) NULL
+ (4*(argc+1))(%r15) envp[0]
+ ...
+ NULL
+*/
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ cfi_startproc
+ /* Mark r14 as undefined in order to stop unwinding here! */
+ cfi_undefined (r14)
+
+ /* Check if the kernel provides highgprs facility if needed by
+ the binary. */
+
+ lr %r6,%r15
+ la %r6,4(%r6) /* Skip the argument counter. */
+
+.L11: l %r5,0(%r6) /* Skip the argument vector. */
+ la %r6,4(%r6)
+ ltr %r5,%r5
+ jne .L11
+
+.L12: l %r5,0(%r6) /* Skip the environment vector. */
+ la %r6,4(%r6)
+ ltr %r5,%r5
+ jne .L12
+
+ /* Usually the auxiliary vector can be expected directly after
+ the environment variables. But we have to skip extra zeros
+ because the loader might have removed unsecure variables for
+ setuid programs. */
+
+.L26: l %r5,0(%r6)
+ la %r6,4(%r6)
+ ltr %r5,%r5
+ jz .L26
+
+ ahi %r6,-4
+
+ /* Obtain the needed values from the auxiliary vector. */
+
+ lhi %r7,16 /* AT_HWCAP */
+ lhi %r8,3 /* AT_PHDR */
+ lhi %r9,5 /* AT_PHNUM */
+ lhi %r2,4 /* AT_PHENT */
+.L13: l %r5,0(%r6)
+ clr %r5,%r7
+ jne .L15
+ l %r10,4(%r6) /* r10 = AT_HWCAP value. */
+.L15: clr %r5,%r8
+ jne .L16
+ l %r11,4(%r6) /* r11 = AT_PHDR value. */
+.L16: clr %r5,%r9
+ jne .L17
+ l %r12,4(%r6) /* r12 = AT_PHNUM value. */
+.L17: clr %r5,%r2
+ jne .L18
+ l %r0,4(%r6) /* r0 = AT_PHENT value. */
+.L18: ltr %r5,%r5
+ la %r6,8(%r6)
+ jnz .L13
+
+ /* Locate the ELF header by looking for the first PT_LOAD
+ segment with a p_offset of zero. */
+
+ lr %r4,%r11 /* Backup AT_PHDR. */
+ lhi %r7,1 /* PT_LOAD id */
+ lhi %r8,0
+.L19: cl %r7,0(%r4) /* p_type == PT_LOAD? */
+ jne .L20
+ cl %r8,4(%r4) /* p_offset == 0? */
+ jne .L20
+ l %r9,8(%r4) /* r9 = PT_LOAD.p_vaddr <- ELF header address */
+ j .L24
+.L20: alr %r4,%r0 /* r4 += AT_PHENT value */
+ brct %r12,.L19
+
+ j .+2 /* Trap, there must be such a phdr. */
+
+.L24: lr %r4,%r11 /* Backup AT_PHDR. */
+ lhi %r2,6 /* PT_PHDR id */
+.L23: cl %r2,0(%r4)
+ jne .L22
+ l %r3,8(%r4) /* r3 = PT_PHDR p_vaddr */
+ j .L25
+.L22: alr %r4,%r0 /* r4 += AT_PHENT value */
+ brct %r12,.L23
+
+ j .L14 /* No PT_PHDR found - skip checking. */
+
+.L25: slr %r11,%r3 /* AT_PHDR - PT_PHDR.p_vaddr (relocation offset)*/
+ alr %r9,%r11 /* PT_LOAD.p_vaddr += relocation offset */
+
+ l %r5,36(%r9) /* Load the e_flags field. */
+ tml %r5,1
+ jz .L14 /* Binary does not require highgprs facility. */
+
+ tml %r10,512 /* Check the AT_HWCAP value. */
+ jz 2 /* Trap if no highgprs facility available. */
+.L14:
+
+ /* Setup pointer to literal pool of _start */
+ basr %r13,0
+.L0: ahi %r13,.Llit-.L0
+
+ /* load argc and argv from stack */
+ la %r4,4(%r15) # get argv
+ l %r3,0(%r15) # get argc
+
+ /* align the stack to a double word boundary */
+ lhi %r0,-8
+ nr %r15,%r0
+
+ /* Setup a stack frame and a parameter area */
+ ahi %r15,-104 # make room on stack
+ xc 0(4,%r15),0(%r15) # clear back-chain
+
+ /* set up arguments for __libc_start_main:
+ main, argc, argv, envp, _init, _fini, rtld_fini, stack_end
+ Note that envp will be determined later in __libc_start_main
+ */
+ stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
+ la %r7,96(%r15)
+ l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini
+ l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init
+ l %r2,.L3-.Llit(%r13) # load pointer to main
+ l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
+#ifdef PIC
+ l %r12,.L5-.Llit(%r13) # load .got pointer
+ la %r6,0(%r13,%r6)
+ la %r5,0(%r13,%r5)
+ la %r12,0(%r13,%r12)
+ l %r2,0(%r12,%r2)
+ la %r1,0(%r13,%r1)
+#endif
+
+ /* ok, now branch to the libc main routine */
+ basr %r14,%r1
+
+ /* crash if __libc_start_main returns */
+ .word 0
+
+ cfi_endproc
+.Llit:
+#ifndef PIC
+.L1: .long __libc_csu_init
+.L2: .long __libc_csu_fini
+.L3: .long main
+.L4: .long __libc_start_main
+#else
+.L1: .long __libc_csu_init-.Llit
+.L2: .long __libc_csu_fini-.Llit
+.L3: .long main@GOT
+.L4: .long __libc_start_main@plt-.Llit
+.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
+#endif
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h b/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..e58e60728ae29c7d3d143be74f2bcfe69b08ab33
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h
@@ -0,0 +1,21 @@
+/* Hacks needed for symbol manipulation. s390 version.
+ Copyright (C) 2017-2019 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
+ . */
+
+#include
+
+#include_next "symbol-hacks.h"
diff --git a/libc/glibc/sysdeps/s390/s390-32/sysdep.h b/libc/glibc/sysdeps/s390/s390-32/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..6605dde237219dbc7f084517ad44f6172c1b39b3
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-32/sysdep.h
@@ -0,0 +1,101 @@
+/* Assembler macros for s390.
+ Copyright (C) 2000-2019 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
+#define ALIGNARG(log2) 1< . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .align 4
+ .globl _init
+ .hidden _init
+ .type _init,@function
+_init:
+ stmg %r6,%r15,48(%r15)
+ lgr %r1,%r15
+ aghi %r15,-160
+ stg %r1,0(%r15)
+ larl %r12,_GLOBAL_OFFSET_TABLE_
+#if PREINIT_FUNCTION_WEAK
+ larl %r1,PREINIT_FUNCTION@GOTENT
+ lg %r1,0(%r1)
+ ltgr %r1,%r1
+ je 1f
+ basr %r14,%r1
+#else
+ brasl %r14,PREINIT_FUNCTION
+#endif
+ .align 4,0x07
+1:
+
+ .section .fini,"ax",@progbits
+ .align 4
+ .globl _fini
+ .hidden _fini
+ .type _fini,@function
+_fini:
+ stmg %r6,%r15,48(%r15)
+ lgr %r1,%r15
+ aghi %r15,-160
+ stg %r1,0(%r15)
+ larl %r12,_GLOBAL_OFFSET_TABLE_
+ .align 4,0x07
diff --git a/libc/glibc/sysdeps/s390/s390-64/crtn.S b/libc/glibc/sysdeps/s390/s390-64/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..34e14112ac052ba60707585d34c5a07bc5fafb40
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-64/crtn.S
@@ -0,0 +1,50 @@
+/* Special .init and .fini section support for 64 bit S/390.
+ Copyright (C) 2001-2019 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init
+ .align 4
+ lg %r4,272(%r15)
+ lmg %r6,%r15,208(%r15)
+ br %r4
+
+ .section .fini
+ .align 4
+ lg %r4,272(%r15)
+ lmg %r6,%r15,208(%r15)
+ br %r4
diff --git a/libc/glibc/sysdeps/s390/s390-64/start.S b/libc/glibc/sysdeps/s390/s390-64/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..1a632f2dc710dad16a739c13678bcb7e8b9a6f26
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-64/start.S
@@ -0,0 +1,107 @@
+/* Startup code compliant to the 64 bit S/390 ELF ABI.
+ Copyright (C) 2001-2019 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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.
+
+ 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
+ . */
+
+#include
+
+/*
+ This is the canonical entry point, usually the first thing in the text
+ segment. Most registers' values are unspecified, except for:
+
+ %r14 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ %r15 The stack contains the arguments and environment:
+ 0(%r15) argc
+ 8(%r15) argv[0]
+ ...
+ (8*argc)(%r15) NULL
+ (8*(argc+1))(%r15) envp[0]
+ ...
+ NULL
+*/
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ cfi_startproc
+ /* Mark r14 as undefined in order to stop unwinding here! */
+ cfi_undefined (r14)
+ /* Load argc and argv from stack. */
+ la %r4,8(%r15) # get argv
+ lg %r3,0(%r15) # get argc
+
+ /* Align the stack to a double word boundary. */
+ lghi %r0,-16
+ ngr %r15,%r0
+
+ /* Setup a stack frame and a parameter area. */
+ aghi %r15,-176 # make room on stack
+ xc 0(8,%r15),0(%r15) # clear back-chain
+
+ /* Set up arguments for __libc_start_main:
+ main, argc, argv, envp, _init, _fini, rtld_fini, stack_end
+ Note that envp will be determined later in __libc_start_main.
+ */
+ stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
+ la %r7,160(%r15)
+ larl %r6,__libc_csu_fini # load pointer to __libc_csu_fini
+ larl %r5,__libc_csu_init # load pointer to __libc_csu_init
+
+ /* Ok, now branch to the libc main routine. */
+#ifdef PIC
+ larl %r2,main@GOTENT # load pointer to main
+ lg %r2,0(%r2)
+ brasl %r14,__libc_start_main@plt
+#else
+ larl %r2,main # load pointer to main
+ brasl %r14,__libc_start_main
+#endif
+
+ /* Crash if __libc_start_main returns. */
+ .word 0
+
+ cfi_endproc
+
+ /* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/glibc/sysdeps/s390/s390-64/sysdep.h b/libc/glibc/sysdeps/s390/s390-64/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..99dbf3f444ba8e264eec46eedc50e8a0414983e4
--- /dev/null
+++ b/libc/glibc/sysdeps/s390/s390-64/sysdep.h
@@ -0,0 +1,94 @@
+/* Assembler macros for 64 bit S/390.
+ Copyright (C) 2001-2019 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */
+#define ALIGNARG(log2) 1< directly; include instead."
+#endif
+
+#ifdef __LITTLE_ENDIAN__
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#define __FLOAT_WORD_ORDER __LITTLE_ENDIAN
+#else
+#define __BYTE_ORDER __BIG_ENDIAN
+#define __FLOAT_WORD_ORDER __BIG_ENDIAN
+#endif
diff --git a/libc/glibc/sysdeps/sh/crti.S b/libc/glibc/sysdeps/sh/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..611762c9ee30afc599000866b68ff3f5cbe6d2a9
--- /dev/null
+++ b/libc/glibc/sysdeps/sh/crti.S
@@ -0,0 +1,122 @@
+/* Special .init and .fini section support for SH.
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+ .section .init,"ax",@progbits
+ .align 5
+ .global _init
+ .hidden _init
+ .type _init, @function
+_init:
+ mov.l r12,@-r15
+ mova .L12,r0
+ mov.l .L12,r12
+ mov.l r14,@-r15
+ add r0,r12
+ sts.l pr,@-r15
+#if PREINIT_FUNCTION_WEAK
+ mov.l .L13,r0
+ mov.l @(r0,r12),r1
+ tst r1,r1
+ bt/s .L8
+ mov r15,r14
+ mov.l .L14,r1
+ bsrf r1
+.LPCS0:
+ nop
+.L8:
+#else
+ mova .L13,r0
+ mov.l .L13,r1
+ add r0,r1
+ jsr @r1
+ mov r15,r14
+#endif
+ bra 1f
+ nop
+ .align 2
+.L12:
+ .long _GLOBAL_OFFSET_TABLE_
+#if PREINIT_FUNCTION_WEAK
+.L13:
+ .long PREINIT_FUNCTION@GOT
+.L14:
+ .long PREINIT_FUNCTION@PLT-(.LPCS0+2-(.))
+#else
+.L13:
+ .long PREINIT_FUNCTION@PLT
+#endif
+1:
+
+ .section .fini,"ax",@progbits
+ .align 5
+ .global _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ mov.l r12,@-r15
+ mova .L19,r0
+ mov.l r14,@-r15
+ sts.l pr,@-r15
+ mov.l .L19,r12
+ mov r15,r14
+ add r0,r12
+ bra 0f
+ nop
+ .align 2
+.L19:
+ .long _GLOBAL_OFFSET_TABLE_
+0:
diff --git a/libc/glibc/sysdeps/sh/crtn.S b/libc/glibc/sysdeps/sh/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..75cc6c2389813c357e467721ef037d34d5da4173
--- /dev/null
+++ b/libc/glibc/sysdeps/sh/crtn.S
@@ -0,0 +1,53 @@
+/* Special .init and .fini section support for SH.
+ Copyright (C) 2000-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",@progbits
+ mov r14,r15
+ lds.l @r15+,pr
+ mov.l @r15+,r14
+ mov.l @r15+,r12
+ rts
+ nop
+
+ .section .fini,"ax",@progbits
+ mov r14,r15
+ lds.l @r15+,pr
+ mov.l @r15+,r14
+ mov.l @r15+,r12
+ rts
+ nop
diff --git a/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..64d9d43b3a8d2c1ccbb263ea1e8ad3f52c5a8499
--- /dev/null
+++ b/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,71 @@
+/* Copyright (C) 2002-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 32
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
+#define __PTHREAD_MUTEX_USE_UNION 1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+#else
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ unsigned long int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/sh/start.S b/libc/glibc/sysdeps/sh/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..d3ef53a63be5b0e0260440859859ea4c66dc7e18
--- /dev/null
+++ b/libc/glibc/sysdeps/sh/start.S
@@ -0,0 +1,111 @@
+/* Startup code for SH & ELF.
+ Copyright (C) 1999-2019 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.
+
+ 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
+ . */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment.
+
+ Note that the code in the .init section has already been run.
+ This includes _init and _libc_init
+
+
+ At this entry point, most registers' values are unspecified, except:
+
+ r4 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ sp The stack contains the arguments and environment:
+ 0(sp) argc
+ 4(sp) argv[0]
+ ...
+ (4*argc)(sp) NULL
+ (4*(argc+1))(sp) envp[0]
+ ...
+ NULL
+*/
+
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ /* Clear the frame pointer since this is the outermost frame. */
+ mov #0, r14
+
+ /* Pop argc off the stack and save a pointer to argv */
+ mov.l @r15+,r5
+ mov r15, r6
+
+ /* Push the last arguments to main() onto the stack */
+ mov.l r4,@-r15
+ mov.l L_fini,r0
+ mov.l r0,@-r15
+
+ /* Set up the other arguments for main() that go in registers */
+ mov.l L_main,r4
+ mov.l L_init,r7
+
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
+
+ /* Let the libc call main and exit with its return code. */
+ mov.l L_libc_start_main,r1
+ jsr @r1
+ nop
+ /* should never get here....*/
+ mov.l L_abort,r1
+ jsr @r1
+ nop
+ .align 2
+L_main:
+ .long main
+L_init:
+ .long __libc_csu_init
+L_fini:
+ .long __libc_csu_fini
+L_libc_start_main:
+ .long __libc_start_main
+L_abort:
+ .long abort
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
+ .global __fpscr_values
+__fpscr_values:
+ .long 0
+ .long 0x80000
diff --git a/libc/glibc/sysdeps/sh/sysdep.h b/libc/glibc/sysdeps/sh/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..51700d61ce17a10cfc82c2760a93acb3e24f83f0
--- /dev/null
+++ b/libc/glibc/sysdeps/sh/sysdep.h
@@ -0,0 +1,75 @@
+/* Assembler macros for SH.
+ Copyright (C) 1999-2019 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Syntactic details of assembler. */
+
+#define ALIGNARG(log2) log2
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+#ifdef SHARED
+#define PLTJMP(_x) _x##@PLT
+#else
+#define PLTJMP(_x) _x
+#endif
+
+
+/* Define an entry point visible from C. */
+#define ENTRY(name) \
+ .globl C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name),@function; \
+ .align ALIGNARG(5); \
+ C_LABEL(name) \
+ cfi_startproc; \
+ CALL_MCOUNT
+
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
+
+/* If compiled for profiling, call `mcount' at the start of each function. */
+#ifdef PROF
+#define CALL_MCOUNT \
+ mov.l 1f,r1; \
+ sts.l pr,@-r15; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (pr, 0); \
+ mova 2f,r0; \
+ jmp @r1; \
+ lds r0,pr; \
+ .align 2; \
+1: .long mcount; \
+2: lds.l @r15+,pr; \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (pr)
+
+#else
+#define CALL_MCOUNT /* Do nothing. */
+#endif
+
+/* Since C identifiers are not normally prefixed with an underscore
+ on this system, the asm identifier `syscall_error' intrudes on the
+ C name space. Make sure we use an innocuous name. */
+#define syscall_error __syscall_error
+#define mcount _mcount
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/sparc/bits/endian.h b/libc/glibc/sysdeps/sparc/bits/endian.h
new file mode 100644
index 0000000000000000000000000000000000000000..8acfdf5df6f365113f34284040f855aa84d62d3a
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/bits/endian.h
@@ -0,0 +1,12 @@
+/* Sparc is big-endian, but v9 supports endian conversion on loads/stores
+ and GCC supports such a mode. Be prepared. */
+
+#ifndef _ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+#ifdef __LITTLE_ENDIAN__
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#else
+# define __BYTE_ORDER __BIG_ENDIAN
+#endif
diff --git a/libc/glibc/sysdeps/sparc/crti.S b/libc/glibc/sysdeps/sparc/crti.S
new file mode 100644
index 0000000000000000000000000000000000000000..3211d4c34a83fb3eee48ac6ece41b1ce9926fd67
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/crti.S
@@ -0,0 +1,95 @@
+/* Special .init and .fini section support for sparc.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+ .fini sections and defines global symbols for those addresses, so
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
+#include
+#include
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+ weak_extern (PREINIT_FUNCTION)
+#else
+ .hidden PREINIT_FUNCTION
+#endif
+
+#ifdef __arch64__
+#define STACKFRAME_SIZE 176
+#define GOT_LOAD ldx
+#else
+#define STACKFRAME_SIZE 96
+#define GOT_LOAD ld
+#endif
+
+ .section .init,"ax",@progbits
+ .p2align 2
+ .globl _init
+ .hidden _init
+ .type _init, @function
+_init:
+ save %sp, -STACKFRAME_SIZE, %sp
+#if PREINIT_FUNCTION_WEAK
+ SETUP_PIC_REG(l7)
+ sethi %gdop_hix22(PREINIT_FUNCTION), %g1
+ xor %g1, %gdop_lox10(PREINIT_FUNCTION), %g1
+ GOT_LOAD [%l7 + %g1], %g1, %gdop(PREINIT_FUNCTION)
+ cmp %g1, 0
+ be 1f
+ nop
+ call PREINIT_FUNCTION
+ nop
+1:
+#else
+ call PREINIT_FUNCTION
+ nop
+#endif
+
+ .section .fini,"ax",@progbits
+ .p2align 2
+ .globl _fini
+ .hidden _fini
+ .type _fini, @function
+_fini:
+ save %sp, -STACKFRAME_SIZE, %sp
diff --git a/libc/glibc/sysdeps/sparc/crtn.S b/libc/glibc/sysdeps/sparc/crtn.S
new file mode 100644
index 0000000000000000000000000000000000000000..31191dfcecf490a8be124bda00bb5f120db5e4dc
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/crtn.S
@@ -0,0 +1,45 @@
+/* Special .init and .fini section support for sparc.
+ Copyright (C) 1995-2019 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.
+
+ 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
+ . */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+ corresponding to the prologues in crti.S. */
+
+ .section .init,"ax",@progbits
+ jmp %i7 + 8
+ restore
+
+ .section .fini,"ax",@progbits
+ jmp %i7 + 8
+ restore
diff --git a/libc/glibc/sysdeps/sparc/dl-dtprocnum.h b/libc/glibc/sysdeps/sparc/dl-dtprocnum.h
new file mode 100644
index 0000000000000000000000000000000000000000..280ff03e582bf14b94c0c1658f1634a537bf0acf
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/dl-dtprocnum.h
@@ -0,0 +1,21 @@
+/* Configuration of lookup functions. SPARC version.
+ Copyright (C) 2000-2019 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
+ . */
+
+/* Number of extra dynamic section entries for this architecture. By
+ default there are none. */
+#define DT_THISPROCNUM DT_SPARC_NUM
diff --git a/libc/glibc/sysdeps/sparc/dl-sysdep.h b/libc/glibc/sysdeps/sparc/dl-sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d5e0eb7fd388b071fd2805c0fc812edca45f6c0
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/dl-sysdep.h
@@ -0,0 +1,23 @@
+/* System-specific settings for dynamic linker code. SPARC version.
+ Copyright (C) 2002-2019 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
+ . */
+
+#include_next
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+ might write into it after _dl_start returns. */
+#define DL_ARGV_NOT_RELRO 1
diff --git a/libc/glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/libc/glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000000000000000000000000000000000000..d632a0c5c7c96484bd4fe458b9e6cdd67a8ec501
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,81 @@
+/* Machine-specific pthread type layouts. SPARC version.
+ Copyright (C) 2003-2019 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
+ . */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H 1
+
+#include
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
+#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+#if __WORDSIZE == 64
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned int __flags;
+#else
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/libc/glibc/sysdeps/sparc/sparc32/start.S b/libc/glibc/sysdeps/sparc/sparc32/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..7372d1a0246f899849e718c71bfda9bb5364d169
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/sparc32/start.S
@@ -0,0 +1,99 @@
+/* Startup code for elf32-sparc
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson , 1997.
+
+ 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
+ . */
+
+#include
+
+
+ .section ".text"
+ .align 4
+ .global _start
+ .type _start,#function
+_start:
+#ifdef PIC
+ SETUP_PIC_REG(l7)
+#endif
+
+ /* Terminate the stack frame, and reserve space for functions to
+ drop their arguments. */
+ mov %g0, %fp
+ sub %sp, 6*4, %sp
+
+ /* Extract the arguments and environment as encoded on the stack. The
+ argument info starts after one register window (16 words) past the SP. */
+ ld [%sp+22*4], %o1
+ add %sp, 23*4, %o2
+
+ /* Load the addresses of the user entry points. */
+#ifndef PIC
+ sethi %hi(main), %o0
+ sethi %hi(__libc_csu_init), %o3
+ sethi %hi(__libc_csu_fini), %o4
+ or %o0, %lo(main), %o0
+ or %o3, %lo(__libc_csu_init), %o3
+ or %o4, %lo(__libc_csu_fini), %o4
+#else
+ sethi %gdop_hix22(main), %o0
+ sethi %gdop_hix22(__libc_csu_init), %o3
+ sethi %gdop_hix22(__libc_csu_fini), %o4
+ xor %o0, %gdop_lox10(main), %o0
+ xor %o3, %gdop_lox10(__libc_csu_init), %o3
+ xor %o4, %gdop_lox10(__libc_csu_fini), %o4
+ ld [%l7 + %o0], %o0, %gdop(main)
+ ld [%l7 + %o3], %o3, %gdop(__libc_csu_init)
+ ld [%l7 + %o4], %o4, %gdop(__libc_csu_fini)
+#endif
+
+ /* When starting a binary via the dynamic linker, %g1 contains the
+ address of the shared library termination function, which will be
+ registered with atexit(). If we are statically linked, this will
+ be NULL. */
+ mov %g1, %o5
+
+ /* Let libc do the rest of the initialization, and call main. */
+ call __libc_start_main
+ nop
+
+ /* Die very horribly if exit returns. */
+ unimp
+
+ .size _start, .-_start
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+weak_alias (__data_start, data_start)
diff --git a/libc/glibc/sysdeps/sparc/sparc64/start.S b/libc/glibc/sysdeps/sparc/sparc64/start.S
new file mode 100644
index 0000000000000000000000000000000000000000..cfccea154c6e1b40d73f1fab2f9a854ba09a9049
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/sparc64/start.S
@@ -0,0 +1,100 @@
+/* Startup code for elf64-sparc
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson , 1997.
+
+ 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
+ . */
+
+#include
+
+
+ .section ".text"
+ .align 4
+ .global _start
+ .type _start,#function
+_start:
+#ifdef PIC
+ SETUP_PIC_REG(l7)
+#endif
+
+ /* Terminate the stack frame, and reserve space for functions to
+ drop their arguments. */
+ mov %g0, %fp
+ sub %sp, 6*8, %sp
+
+ /* Extract the arguments and environment as encoded on the stack. The
+ argument info starts after one register window (16 words) past the SP,
+ plus the bias we added, plus the magic v9 STACK_BIAS. */
+ ldx [%sp+STACK_BIAS+22*8], %o1
+ add %sp, STACK_BIAS+23*8, %o2
+
+ /* Load the addresses of the user entry points. */
+#ifndef PIC
+ sethi %hi(main), %o0
+ sethi %hi(__libc_csu_init), %o3
+ sethi %hi(__libc_csu_fini), %o4
+ or %o0, %lo(main), %o0
+ or %o3, %lo(__libc_csu_init), %o3
+ or %o4, %lo(__libc_csu_fini), %o4
+#else
+ sethi %gdop_hix22(main), %o0
+ sethi %gdop_hix22(__libc_csu_init), %o3
+ sethi %gdop_hix22(__libc_csu_fini), %o4
+ xor %o0, %gdop_lox10(main), %o0
+ xor %o3, %gdop_lox10(__libc_csu_init), %o3
+ xor %o4, %gdop_lox10(__libc_csu_fini), %o4
+ ldx [%l7 + %o0], %o0, %gdop(main)
+ ldx [%l7 + %o3], %o3, %gdop(__libc_csu_init)
+ ldx [%l7 + %o4], %o4, %gdop(__libc_csu_fini)
+#endif
+
+ /* When starting a binary via the dynamic linker, %g1 contains the
+ address of the shared library termination function, which will be
+ registered with atexit(). If we are statically linked, this will
+ be NULL. */
+ mov %g1, %o5
+
+ /* Let libc do the rest of the initialization, and call main. */
+ call __libc_start_main
+ nop
+
+ /* Die very horribly if exit returns. */
+ illtrap 0
+
+ .size _start, .-_start
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+weak_alias (__data_start, data_start)
diff --git a/libc/glibc/sysdeps/sparc/sysdep.h b/libc/glibc/sysdeps/sparc/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..31a8addebcbeec2f60ece377677bc2be137b3664
--- /dev/null
+++ b/libc/glibc/sysdeps/sparc/sysdep.h
@@ -0,0 +1,82 @@
+/* Copyright (C) 2011-2019 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
+ . */
+
+#define _SYSDEPS_SYSDEP_H 1
+#include
+
+#ifdef __ASSEMBLER__
+
+#define SPARC_PIC_THUNK(reg) \
+ .ifndef __sparc_get_pc_thunk.reg; \
+ .section .text.__sparc_get_pc_thunk.reg,"axG",@progbits,__sparc_get_pc_thunk.reg,comdat; \
+ .align 32; \
+ .weak __sparc_get_pc_thunk.reg; \
+ .hidden __sparc_get_pc_thunk.reg; \
+ .type __sparc_get_pc_thunk.reg, #function; \
+__sparc_get_pc_thunk.reg: \
+ jmp %o7 + 8; \
+ add %o7, %reg, %##reg; \
+ .previous; \
+ .endif;
+
+/* The "-4" and "+4" offsets against _GLOBAL_OFFSET_TABLE_ are
+ critical since they represent the offset from the thunk call to the
+ instruction containing the _GLOBAL_OFFSET_TABLE_ reference.
+ Therefore these instructions cannot be moved around without
+ appropriate adjustments to those offsets.
+
+ Furthermore, these expressions are special in another regard. When
+ the assembler sees a reference to _GLOBAL_OFFSET_TABLE_ inside of
+ a %hi() or %lo(), it emits a PC-relative relocation. This causes
+ R_SPARC_HI22 to turn into R_SPARC_PC22, and R_SPARC_LO10 to turn into
+ R_SPARC_PC10, respectively.
+
+ Even when v9 we use a call sequence instead of using "rd %pc" because
+ RDPC is extremely expensive and incurs a full pipeline flush. */
+
+#define SPARC_PIC_THUNK_CALL(reg) \
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %##reg; \
+ call __sparc_get_pc_thunk.reg; \
+ or %##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg;
+
+#define SETUP_PIC_REG(reg) \
+ SPARC_PIC_THUNK(reg) \
+ SPARC_PIC_THUNK_CALL(reg)
+
+#define SETUP_PIC_REG_LEAF(reg, tmp) \
+ SPARC_PIC_THUNK(reg) \
+ mov %o7, %##tmp; \
+ SPARC_PIC_THUNK_CALL(reg); \
+ mov %##tmp, %o7;
+
+#undef ENTRY
+#define ENTRY(name) \
+ .align 4; \
+ .global C_SYMBOL_NAME(name); \
+ .type name, @function; \
+C_LABEL(name) \
+ cfi_startproc;
+
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ .size name, . - name
+
+#undef LOC
+#define LOC(name) .L##name
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/unix/alpha/sysdep.h b/libc/glibc/sysdeps/unix/alpha/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..05f8cde80b10c4d53a7e3f94ad46c3cf9e6cf45b
--- /dev/null
+++ b/libc/glibc/sysdeps/unix/alpha/sysdep.h
@@ -0,0 +1,382 @@
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Brendan Kehoe (brendan@zen.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, see
+ . */
+
+#include
+#include /* Defines RTLD_PRIVATE_ERRNO. */
+
+#ifdef __ASSEMBLER__
+
+#ifdef __linux__
+# include
+#else
+# include
+#endif
+
+#define __LABEL(x) x##:
+
+#define LEAF(name, framesize) \
+ .globl name; \
+ .align 4; \
+ .ent name, 0; \
+ __LABEL(name) \
+ .frame sp, framesize, ra
+
+#define ENTRY(name) \
+ .globl name; \
+ .align 4; \
+ .ent name, 0; \
+ __LABEL(name) \
+ .frame sp, 0, ra
+
+/* Mark the end of function SYM. */
+#undef END
+#define END(sym) .end sym
+
+#ifdef PROF
+# define PSEUDO_PROF \
+ .set noat; \
+ lda AT, _mcount; \
+ jsr AT, (AT), _mcount; \
+ .set at
+#else
+# define PSEUDO_PROF
+#endif
+
+#ifdef PROF
+# define PSEUDO_PROLOGUE \
+ .frame sp, 0, ra; \
+ ldgp gp,0(pv); \
+ PSEUDO_PROF; \
+ .prologue 1
+#elif defined PIC
+# define PSEUDO_PROLOGUE \
+ .frame sp, 0, ra; \
+ .prologue 0
+#else
+# define PSEUDO_PROLOGUE \
+ .frame sp, 0, ra; \
+ ldgp gp,0(pv); \
+ .prologue 1
+#endif /* PROF */
+
+#ifdef PROF
+# define USEPV_PROF std
+#else
+# define USEPV_PROF no
+#endif
+
+#if RTLD_PRIVATE_ERRNO
+# define SYSCALL_ERROR_LABEL $syscall_error
+# define SYSCALL_ERROR_HANDLER \
+$syscall_error: \
+ stl v0, rtld_errno(gp) !gprel; \
+ lda v0, -1; \
+ ret
+# define SYSCALL_ERROR_FALLTHRU
+#elif defined(PIC)
+# define SYSCALL_ERROR_LABEL __syscall_error !samegp
+# define SYSCALL_ERROR_HANDLER
+# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL
+#else
+# define SYSCALL_ERROR_LABEL $syscall_error
+# define SYSCALL_ERROR_HANDLER \
+$syscall_error: \
+ jmp $31, __syscall_error
+# define SYSCALL_ERROR_FALLTHRU
+#endif /* RTLD_PRIVATE_ERRNO */
+
+/* Overridden by specific syscalls. */
+#undef PSEUDO_PREPARE_ARGS
+#define PSEUDO_PREPARE_ARGS /* Nothing. */
+
+#define PSEUDO(name, syscall_name, args) \
+ .globl name; \
+ .align 4; \
+ .ent name,0; \
+__LABEL(name) \
+ PSEUDO_PROLOGUE; \
+ PSEUDO_PREPARE_ARGS \
+ lda v0, SYS_ify(syscall_name); \
+ call_pal PAL_callsys; \
+ bne a3, SYSCALL_ERROR_LABEL
+
+#undef PSEUDO_END
+#define PSEUDO_END(sym) \
+ SYSCALL_ERROR_HANDLER; \
+ END(sym)
+
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .globl name; \
+ .align 4; \
+ .ent name,0; \
+__LABEL(name) \
+ PSEUDO_PROLOGUE; \
+ PSEUDO_PREPARE_ARGS \
+ lda v0, SYS_ify(syscall_name); \
+ call_pal PAL_callsys;
+
+#undef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(sym) END(sym)
+
+#define ret_NOERRNO ret
+
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .globl name; \
+ .align 4; \
+ .ent name,0; \
+__LABEL(name) \
+ PSEUDO_PROLOGUE; \
+ PSEUDO_PREPARE_ARGS \
+ lda v0, SYS_ify(syscall_name); \
+ call_pal PAL_callsys;
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(sym) END(sym)
+
+#define ret_ERRVAL ret
+
+#define r0 v0
+#define r1 a4
+
+#define MOVE(x,y) mov x,y
+
+#else /* !ASSEMBLER */
+
+/* In order to get __set_errno() definition in INLINE_SYSCALL. */
+#include
+
+/* ??? Linux needs to be able to override INLINE_SYSCALL for one
+ particular special case. Make this easy. */
+
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+ INLINE_SYSCALL1(name, nr, args)
+
+#define INLINE_SYSCALL1(name, nr, args...) \
+({ \
+ long _sc_ret, _sc_err; \
+ inline_syscall##nr(__NR_##name, args); \
+ if (__builtin_expect (_sc_err, 0)) \
+ { \
+ __set_errno (_sc_ret); \
+ _sc_ret = -1L; \
+ } \
+ _sc_ret; \
+})
+
+#define INTERNAL_SYSCALL(name, err_out, nr, args...) \
+ INTERNAL_SYSCALL1(name, err_out, nr, args)
+
+#define INTERNAL_SYSCALL1(name, err_out, nr, args...) \
+ INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args)
+
+#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \
+({ \
+ long _sc_ret, _sc_err; \
+ inline_syscall##nr(name, args); \
+ err_out = _sc_err; \
+ _sc_ret; \
+})
+
+#define INTERNAL_SYSCALL_DECL(err) \
+ long int err __attribute__((unused))
+
+/* The normal Alpha calling convention sign-extends 32-bit quantties
+ no matter what the "real" sign of the 32-bit type. We want to
+ preserve that when filling in values for the kernel. */
+#define syscall_promote(arg) \
+ (sizeof(arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
+
+/* Make sure and "use" the variable that we're not returning,
+ in order to suppress unused variable warnings. */
+#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void)val, err)
+#define INTERNAL_SYSCALL_ERRNO(val, err) ((void)err, val)
+
+#define inline_syscall_clobbers \
+ "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
+ "$22", "$23", "$24", "$25", "$27", "$28", "memory"
+
+/* It is moderately important optimization-wise to limit the lifetime
+ of the hard-register variables as much as possible. Thus we copy
+ in/out as close to the asm as possible. */
+
+#define inline_syscall0(name, args...) \
+{ \
+ register long _sc_19 __asm__("$19"); \
+ register long _sc_0 = name; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2" \
+ : "+v"(_sc_0), "=r"(_sc_19) \
+ : : inline_syscall_clobbers, \
+ "$16", "$17", "$18", "$20", "$21"); \
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+}
+
+#define inline_syscall1(name,arg1) \
+{ \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_19 __asm__("$19"); \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3" \
+ : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \
+ : : inline_syscall_clobbers, \
+ "$17", "$18", "$20", "$21"); \
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+}
+
+#define inline_syscall2(name,arg1,arg2) \
+{ \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_19 __asm__("$19"); \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4" \
+ : "+v"(_sc_0), "=r"(_sc_19), \
+ "+r"(_sc_16), "+r"(_sc_17) \
+ : : inline_syscall_clobbers, \
+ "$18", "$20", "$21"); \
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+}
+
+#define inline_syscall3(name,arg1,arg2,arg3) \
+{ \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
+ register long _sc_19 __asm__("$19"); \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5" \
+ : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18) \
+ : : inline_syscall_clobbers, "$20", "$21"); \
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+}
+
+#define inline_syscall4(name,arg1,arg2,arg3,arg4) \
+{ \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _tmp_19 = syscall_promote (arg4); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
+ register long _sc_19 __asm__("$19") = _tmp_19; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18) \
+ : : inline_syscall_clobbers, "$20", "$21"); \
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+}
+
+#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
+{ \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _tmp_19 = syscall_promote (arg4); \
+ register long _tmp_20 = syscall_promote (arg5); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
+ register long _sc_19 __asm__("$19") = _tmp_19; \
+ register long _sc_20 __asm__("$20") = _tmp_20; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \
+ : : inline_syscall_clobbers, "$21"); \
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+}
+
+#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
+{ \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _tmp_19 = syscall_promote (arg4); \
+ register long _tmp_20 = syscall_promote (arg5); \
+ register long _tmp_21 = syscall_promote (arg6); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
+ register long _sc_19 __asm__("$19") = _tmp_19; \
+ register long _sc_20 __asm__("$20") = _tmp_20; \
+ register long _sc_21 __asm__("$21") = _tmp_21; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \
+ "+r"(_sc_21) \
+ : : inline_syscall_clobbers); \
+ _sc_ret = _sc_0, _sc_err = _sc_19; \
+}
+#endif /* ASSEMBLER */
+
+/* Pointer mangling support. Note that tls access is slow enough that
+ we don't deoptimize things by placing the pointer check value there. */
+
+#ifdef __ASSEMBLER__
+# if IS_IN (rtld)
+# define PTR_MANGLE(dst, src, tmp) \
+ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
+ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# elif defined SHARED
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard; \
+ xor src, tmp, dst
+# else
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard_local; \
+ xor src, tmp, dst
+# endif
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+#else
+# include
+# if (IS_IN (rtld) \
+ || (!defined SHARED && (IS_IN (libc) \
+ || IS_IN (libpthread))))
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
+# endif
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+#endif /* ASSEMBLER */
diff --git a/libc/glibc/sysdeps/unix/arm/sysdep.h b/libc/glibc/sysdeps/unix/arm/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d619d70a3c831de59af10dd6ce6ebc67df92dc7
--- /dev/null
+++ b/libc/glibc/sysdeps/unix/arm/sysdep.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 1997-2019 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
+ . */
+
+#include
+#include
+
+/* Some definitions to allow the assembler in sysdeps/unix/ to build
+ without needing ARM-specific versions of all the files. */
+
+#ifdef __ASSEMBLER__
+
+#define ret DO_RET (r14)
+#define MOVE(a,b) mov b,a
+
+#endif
diff --git a/libc/glibc/sysdeps/unix/i386/sysdep.h b/libc/glibc/sysdeps/unix/i386/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..2e438d2be8fb6b5d672baae8b53c141a87738ff4
--- /dev/null
+++ b/libc/glibc/sysdeps/unix/i386/sysdep.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991-2019 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
+ . */
+
+#include
+#include
+
+#ifdef __ASSEMBLER__
+
+/* This is defined as a separate macro so that other sysdep.h files
+ can include this one and then redefine DO_CALL. */
+
+#define DO_CALL(syscall_name, args) \
+ lea SYS_ify (syscall_name), %eax; \
+ lcall $7, $0
+
+#define r0 %eax /* Normal return-value register. */
+#define r1 %edx /* Secondary return-value register. */
+#define scratch %ecx /* Call-clobbered register for random use. */
+#define MOVE(x,y) movl x, y
+
+#endif /* __ASSEMBLER__ */
diff --git a/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h b/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..15d84187ef5fa8809763635b669a01245edc2e73
--- /dev/null
+++ b/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h
@@ -0,0 +1,56 @@
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Brendan Kehoe (brendan@zen.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, see
+ . */
+
+#include
+
+/* Note that while it's better structurally, going back to call __syscall_error
+ can make things confusing if you're debugging---it looks like it's jumping
+ backwards into the previous fn. */
+#ifdef __PIC__
+#define PSEUDO(name, syscall_name, args) \
+ .align 2; \
+ .set nomips16; \
+ cfi_startproc; \
+ 99: la t9,__syscall_error; \
+ jr t9; \
+ cfi_endproc; \
+ ENTRY(name) \
+ .set noreorder; \
+ .cpload t9; \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ .set reorder; \
+ bne a3, zero, 99b; \
+L(syse1):
+#else
+#define PSEUDO(name, syscall_name, args) \
+ .set noreorder; \
+ .set nomips16; \
+ .align 2; \
+ cfi_startproc; \
+ 99: j __syscall_error; \
+ nop; \
+ cfi_endproc; \
+ ENTRY(name) \
+ .set noreorder; \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ .set reorder; \
+ bne a3, zero, 99b; \
+L(syse1):
+#endif
diff --git a/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h b/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..c89b89264055f8ea8c7936b115e94f611ef42dbc
--- /dev/null
+++ b/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Alexandre Oliva .
+
+ 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Note that while it's better structurally, going back to call __syscall_error
+ can make things confusing if you're debugging---it looks like it's jumping
+ backwards into the previous fn. */
+#ifdef __PIC__
+#define PSEUDO(name, syscall_name, args) \
+ .align 2; \
+ .set nomips16; \
+ cfi_startproc; \
+ 99:; \
+ .set noat; \
+ .cpsetup t9, $1, name; \
+ cfi_register (gp, $1); \
+ .set at; \
+ la t9,__syscall_error; \
+ .cpreturn; \
+ cfi_restore (gp); \
+ jr t9; \
+ cfi_endproc; \
+ ENTRY(name) \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ bne a3, zero, 99b; \
+L(syse1):
+#else
+#define PSEUDO(name, syscall_name, args) \
+ .set noreorder; \
+ .align 2; \
+ .set nomips16; \
+ cfi_startproc; \
+ 99: j __syscall_error; \
+ nop; \
+ cfi_endproc; \
+ ENTRY(name) \
+ .set noreorder; \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ .set reorder; \
+ bne a3, zero, 99b; \
+L(syse1):
+#endif
+
+#endif
diff --git a/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h b/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a48bb69c71f4c2566418bce2b13b6a72d425332
--- /dev/null
+++ b/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Alexandre Oliva .
+
+ 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
+ . */
+
+#include
+
+#ifdef __ASSEMBLER__
+
+/* Note that while it's better structurally, going back to call __syscall_error
+ can make things confusing if you're debugging---it looks like it's jumping
+ backwards into the previous fn. */
+#ifdef __PIC__
+#define PSEUDO(name, syscall_name, args) \
+ .align 2; \
+ .set nomips16; \
+ cfi_startproc; \
+ 99:; \
+ .set noat; \
+ .cpsetup t9, $1, name; \
+ cfi_register (gp, $1); \
+ .set at; \
+ dla t9,__syscall_error; \
+ .cpreturn; \
+ cfi_restore (gp); \
+ jr t9; \
+ cfi_endproc; \
+ ENTRY(name) \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ bne a3, zero, 99b; \
+L(syse1):
+#else
+#define PSEUDO(name, syscall_name, args) \
+ .set noreorder; \
+ .align 2; \
+ .set nomips16; \
+ cfi_startproc; \
+ 99: j __syscall_error; \
+ nop; \
+ cfi_endproc; \
+ ENTRY(name) \
+ .set noreorder; \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ .set reorder; \
+ bne a3, zero, 99b; \
+L(syse1):
+#endif
+
+#endif
diff --git a/libc/glibc/sysdeps/unix/mips/sysdep.h b/libc/glibc/sysdeps/unix/mips/sysdep.h
new file mode 100644
index 0000000000000000000000000000000000000000..dd47f05e4e65eca568ccd3a7e203f1d1bb63c4ee
--- /dev/null
+++ b/libc/glibc/sysdeps/unix/mips/sysdep.h
@@ -0,0 +1,85 @@
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Brendan Kehoe (brendan@zen.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, see
+