support other architectures for glibc startup files
parent
b554f6294f
commit
697b1233f0
269
CMakeLists.txt
269
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
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
/* Define the machine-dependent type `jmp_buf'. Stub version. */
|
||||
|
||||
#ifndef _SETJMP_H
|
||||
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
|
||||
#endif
|
||||
|
||||
typedef int __jmp_buf[1];
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* Never include this file directly; use <time.h> instead.
|
||||
*/
|
||||
|
||||
#ifndef _BITS_TIME_H
|
||||
#define _BITS_TIME_H 1
|
||||
|
||||
#include <bits/types.h>
|
||||
|
||||
/* 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: <time.h>
|
||||
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 */
|
|
@ -1,34 +0,0 @@
|
|||
#ifndef _SCHED_H
|
||||
#include <posix/sched.h>
|
||||
|
||||
#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
|
|
@ -1,69 +0,0 @@
|
|||
#ifndef _SETJMP_H
|
||||
#include <setjmp/setjmp.h>
|
||||
|
||||
#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 <stddef.h>
|
||||
# include <jmp_buf-macros.h>
|
||||
|
||||
# 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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 <stackinfo.h>
|
||||
|
||||
#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 */
|
|
@ -1 +0,0 @@
|
|||
#include <misc/sys/param.h>
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_TIME_H
|
||||
# include <time/sys/time.h>
|
||||
|
||||
# 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
|
|
@ -0,0 +1 @@
|
|||
#include <misc/syscall.h>
|
|
@ -1,159 +0,0 @@
|
|||
#ifndef _TIME_H
|
||||
#include <time/time.h>
|
||||
|
||||
#ifndef _ISOMAC
|
||||
# include <bits/types/locale_t.h>
|
||||
|
||||
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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_PARAM_H
|
||||
#define _SYS_PARAM_H 1
|
||||
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <limits.h>
|
||||
#include <endian.h> /* Define BYTE_ORDER et al. */
|
||||
#include <signal.h> /* Define NSIG. */
|
||||
|
||||
/* This file defines some things in system-specific ways. */
|
||||
#include <bits/param.h>
|
||||
|
||||
|
||||
/* BSD names for some <limits.h> 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 */
|
|
@ -0,0 +1 @@
|
|||
#include <sys/syscall.h>
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SCHED_H
|
||||
#define _SCHED_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* Get type definitions. */
|
||||
#include <bits/types.h>
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#include <bits/types/time_t.h>
|
||||
#include <bits/types/struct_timespec.h>
|
||||
#ifndef __USE_XOPEN2K
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
#ifndef __pid_t_defined
|
||||
typedef __pid_t pid_t;
|
||||
# define __pid_t_defined
|
||||
#endif
|
||||
|
||||
/* Get system specific constant and data structure definitions. */
|
||||
#include <bits/sched.h>
|
||||
#include <bits/cpu-set.h>
|
||||
|
||||
/* 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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.13 Nonlocal jumps <setjmp.h>
|
||||
*/
|
||||
|
||||
#ifndef _SETJMP_H
|
||||
#define _SETJMP_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/setjmp.h> /* Get `__jmp_buf'. */
|
||||
#include <bits/types/__sigset_t.h>
|
||||
|
||||
/* Calling environment, plus possibly a saved signal mask. */
|
||||
struct __jmp_buf_tag
|
||||
{
|
||||
/* NOTE: The machine-dependent definitions of `__sigsetjmp'
|
||||
assume that a `jmp_buf' begins with a `__jmp_buf' and that
|
||||
`__mask_was_saved' follows it. Do not move these members
|
||||
or add others before it. */
|
||||
__jmp_buf __jmpbuf; /* Calling environment. */
|
||||
int __mask_was_saved; /* Saved the signal mask? */
|
||||
__sigset_t __saved_mask; /* Saved signal mask. */
|
||||
};
|
||||
|
||||
|
||||
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 <bits/setjmp2.h>
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* setjmp.h */
|
|
@ -1,5 +1,5 @@
|
|||
/* Determine whether block of given size can be allocated on the stack or not.
|
||||
Copyright (C) 2002-2019 Free Software Foundation, Inc.
|
||||
/* 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
|
||||
|
@ -13,20 +13,18 @@
|
|||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
License along with the GNU C Library. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <alloca.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
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)
|
||||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <sysdep.h>
|
||||
#include <libc-symbols.h>
|
||||
|
||||
#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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include_next <dl-sysdep.h>
|
||||
|
||||
/* _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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_PTHREADTYPES_ARCH_H
|
||||
#define _BITS_PTHREADTYPES_ARCH_H 1
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _AARCH64_SYSDEP_H
|
||||
#define _AARCH64_SYSDEP_H
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
|
||||
#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<<PTR_LOG_SIZE)
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
/* Syntactic details of assembler. */
|
||||
|
||||
#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 4; \
|
||||
C_LABEL(name) \
|
||||
cfi_startproc; \
|
||||
CALL_MCOUNT
|
||||
|
||||
/* Define an entry point visible from C. */
|
||||
#define ENTRY_ALIGN(name, align) \
|
||||
.globl C_SYMBOL_NAME(name); \
|
||||
.type C_SYMBOL_NAME(name),%function; \
|
||||
.p2align align; \
|
||||
C_LABEL(name) \
|
||||
cfi_startproc; \
|
||||
CALL_MCOUNT
|
||||
|
||||
/* Define an entry point visible from C with a specified alignment and
|
||||
pre-padding with NOPs. This can be used to ensure that a critical
|
||||
loop within a function is cache line aligned. Note this version
|
||||
does not adjust the padding if CALL_MCOUNT is defined. */
|
||||
|
||||
#define ENTRY_ALIGN_AND_PAD(name, align, padding) \
|
||||
.globl C_SYMBOL_NAME(name); \
|
||||
.type C_SYMBOL_NAME(name),%function; \
|
||||
.p2align align; \
|
||||
.rep padding; \
|
||||
nop; \
|
||||
.endr; \
|
||||
C_LABEL(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
|
||||
# define CALL_MCOUNT \
|
||||
str x30, [sp, #-80]!; \
|
||||
cfi_adjust_cfa_offset (80); \
|
||||
cfi_rel_offset (x30, 0); \
|
||||
stp x0, x1, [sp, #16]; \
|
||||
cfi_rel_offset (x0, 16); \
|
||||
cfi_rel_offset (x1, 24); \
|
||||
stp x2, x3, [sp, #32]; \
|
||||
cfi_rel_offset (x2, 32); \
|
||||
cfi_rel_offset (x3, 40); \
|
||||
stp x4, x5, [sp, #48]; \
|
||||
cfi_rel_offset (x4, 48); \
|
||||
cfi_rel_offset (x5, 56); \
|
||||
stp x6, x7, [sp, #64]; \
|
||||
cfi_rel_offset (x6, 64); \
|
||||
cfi_rel_offset (x7, 72); \
|
||||
mov x0, x30; \
|
||||
bl mcount; \
|
||||
ldp x0, x1, [sp, #16]; \
|
||||
cfi_restore (x0); \
|
||||
cfi_restore (x1); \
|
||||
ldp x2, x3, [sp, #32]; \
|
||||
cfi_restore (x2); \
|
||||
cfi_restore (x3); \
|
||||
ldp x4, x5, [sp, #48]; \
|
||||
cfi_restore (x4); \
|
||||
cfi_restore (x5); \
|
||||
ldp x6, x7, [sp, #64]; \
|
||||
cfi_restore (x6); \
|
||||
cfi_restore (x7); \
|
||||
ldr x30, [sp], #80; \
|
||||
cfi_adjust_cfa_offset (-80); \
|
||||
cfi_restore (x30);
|
||||
#else
|
||||
# define CALL_MCOUNT /* Do nothing. */
|
||||
#endif
|
||||
|
||||
/* Local label name for asm code. */
|
||||
#ifndef L
|
||||
# define L(name) .L##name
|
||||
#endif
|
||||
|
||||
/* Load or store to/from a pc-relative EXPR into/from R, using T.
|
||||
Note R and T are register numbers and not register names. */
|
||||
#define LDST_PCREL(OP, R, T, EXPR) \
|
||||
adrp x##T, EXPR; \
|
||||
OP PTR_REG (R), [x##T, #:lo12:EXPR]; \
|
||||
|
||||
/* Load or store to/from a got-relative EXPR into/from R, using T.
|
||||
Note R and T are register numbers and not register names. */
|
||||
#define LDST_GLOBAL(OP, R, T, EXPR) \
|
||||
adrp x##T, :got:EXPR; \
|
||||
ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \
|
||||
OP PTR_REG (R), [x##T];
|
||||
|
||||
/* Load an immediate into R.
|
||||
Note R is a register number and not a register name. */
|
||||
#ifdef __LP64__
|
||||
# define MOVL(R, NAME) \
|
||||
movz PTR_REG (R), #:abs_g3:NAME; \
|
||||
movk PTR_REG (R), #:abs_g2_nc:NAME; \
|
||||
movk PTR_REG (R), #:abs_g1_nc:NAME; \
|
||||
movk PTR_REG (R), #:abs_g0_nc:NAME;
|
||||
#else
|
||||
# define MOVL(R, NAME) \
|
||||
movz PTR_REG (R), #:abs_g1:NAME; \
|
||||
movk PTR_REG (R), #:abs_g0_nc:NAME;
|
||||
#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__ */
|
||||
|
||||
#endif /* _AARCH64_SYSDEP_H */
|
|
@ -0,0 +1,7 @@
|
|||
/* Alpha is little-endian. */
|
||||
|
||||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
|
||||
#endif
|
||||
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -0,0 +1,3 @@
|
|||
/* Number of extra dynamic section entries for this architecture. By
|
||||
default there are none. */
|
||||
#define DT_THISPROCNUM DT_ALPHA_NUM
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include_next <dl-sysdep.h>
|
||||
|
||||
/* _dl_argv cannot be attribute_relro, because _dl_start_user
|
||||
might write into it after _dl_start returns. */
|
||||
#define DL_ARGV_NOT_RELRO 1
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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 */
|
|
@ -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 <rth@tamu.edu>
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
In addition to the permissions in the GNU Lesser General Public
|
||||
License, the Free Software Foundation gives you unlimited
|
||||
permission to link the compiled version of this file with other
|
||||
programs, and to distribute those programs without any restriction
|
||||
coming from the use of this file. (The GNU Lesser General Public
|
||||
License restrictions do apply in other respects; for example, they
|
||||
cover modification of the file, and distribution when not linked
|
||||
into another program.)
|
||||
|
||||
Note that people who make modified versions of this file are not
|
||||
obligated to grant this special exception for their modified
|
||||
versions; it is their choice whether to do so. The GNU Lesser
|
||||
General Public License gives permission to release a modified
|
||||
version without this exception; this exception also makes it
|
||||
possible to release a modified version which carries forward this
|
||||
exception.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
.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
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
|
||||
#endif
|
||||
|
||||
/* ARM can be either big or little endian. */
|
||||
#ifdef __ARMEB__
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
#else
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#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}
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Always build .init and .fini sections in ARM mode. */
|
||||
#define NO_THUMB
|
||||
#include <sysdep.h>
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include_next <dl-sysdep.h>
|
||||
|
||||
/* _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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_PTHREADTYPES_ARCH_H
|
||||
#define _BITS_PTHREADTYPES_ARCH_H 1
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
#include <features.h>
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
# include <stdint.h>
|
||||
#else
|
||||
# include <arm-features.h>
|
||||
#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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <sysdep.h>
|
||||
|
||||
.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
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
|
||||
#endif
|
||||
|
||||
#ifdef __CSKYBE__
|
||||
# error "Big endian not supported for C-SKY."
|
||||
#else
|
||||
# define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include_next <dl-sysdep.h>
|
||||
|
||||
/* _dl_argv cannot be attribute_relro, because _dl_start_user
|
||||
might write into it after _dl_start returns. */
|
||||
#define DL_ARGV_NOT_RELRO 1
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_PTHREADTYPES_ARCH_H
|
||||
#define _BITS_PTHREADTYPES_ARCH_H 1
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
#include <features.h>
|
||||
|
||||
#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
|
|
@ -1,4 +0,0 @@
|
|||
extern inline int __libc_use_alloca (size_t size)
|
||||
{
|
||||
return size <= __MAX_ALLOCA_CUTOFF;
|
||||
}
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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. */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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.
|
||||
*/
|
|
@ -0,0 +1,7 @@
|
|||
/* hppa1.1 big-endian. */
|
||||
|
||||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
|
||||
#endif
|
||||
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
.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
|
|
@ -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, <drepper@cygnus.com>, 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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
|
||||
#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__ */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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 */
|
|
@ -1,4 +1,4 @@
|
|||
/* Signal number constants. Generic version.
|
||||
/* 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.
|
||||
|
||||
|
@ -16,17 +16,9 @@
|
|||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_SIGNUM_H
|
||||
#define _BITS_SIGNUM_H 1
|
||||
#ifndef _THREAD_SHARED_TYPES_H
|
||||
#define _THREAD_SHARED_TYPES_H 1
|
||||
|
||||
#ifndef _SIGNAL_H
|
||||
#error "Never include <bits/signum.h> directly; use <signal.h> instead."
|
||||
#endif
|
||||
#include <bits/pthreadtypes-arch.h>
|
||||
|
||||
#include <bits/signum-generic.h>
|
||||
|
||||
/* 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. */
|
||||
#endif /* _THREAD_SHARED_TYPES_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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_LIBC_LOCKP_H
|
||||
#define _BITS_LIBC_LOCKP_H 1
|
||||
|
||||
#include <pthread.h>
|
||||
#include <pthread-functions.h>
|
||||
|
||||
/* 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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* POSIX Threads Extension: ??? <pthread.h>
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_H
|
||||
#define _PTHREAD_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#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 <sched.h>
|
||||
#include <time.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/pthreadtypes.h>
|
||||
|
||||
#include <bits/pthread.h>
|
||||
|
||||
/* 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 <bits/types/struct___pthread_attr.h>
|
||||
|
||||
/* 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 <bits/types/struct___pthread_mutexattr.h>
|
||||
|
||||
/* 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 <bits/types/struct___pthread_mutex.h>
|
||||
|
||||
#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 <bits/types/struct___pthread_condattr.h>
|
||||
|
||||
/* 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 <bits/types/struct___pthread_cond.h>
|
||||
|
||||
#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 <bits/types/__pthread_spinlock_t.h>
|
||||
|
||||
# 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 <bits/spin-lock-inline.h>
|
||||
|
||||
__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 <bits/types/struct___pthread_rwlockattr.h>
|
||||
|
||||
/* 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 <bits/types/struct___pthread_rwlock.h>
|
||||
|
||||
# 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 <bits/cancelation.h>
|
||||
|
||||
#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 <bits/types/struct___pthread_barrierattr.h>
|
||||
|
||||
/* 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 <bits/types/struct___pthread_barrier.h>
|
||||
|
||||
/* 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 <bits/types/__pthread_key.h>
|
||||
|
||||
/* 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 <bits/types/struct___pthread_once.h>
|
||||
|
||||
#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 <signal.h>). */
|
||||
|
||||
/* 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 <bits/pthread-np.h>
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* pthread.h */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#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)
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_PTHREADTYPES_ARCH_H
|
||||
#define _BITS_PTHREADTYPES_ARCH_H 1
|
||||
|
||||
#endif /* bits/pthreadtypes.h */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <sysdep.h>
|
||||
|
||||
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 <seidl@janed.com>
|
||||
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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/wordsize-32/divdi3-symbol-hacks.h>
|
||||
|
||||
#include_next "symbol-hacks.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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/x86/sysdep.h>
|
||||
|
||||
#include <features.h> /* 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__ */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
#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#
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#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#
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Number of extra dynamic section entries for this architecture. By
|
||||
default there are none. */
|
||||
#define DT_THISPROCNUM DT_IA_64_NUM
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include_next <dl-sysdep.h>
|
||||
|
||||
/* _dl_argv cannot be attribute_relro, because _dl_start_user
|
||||
might write into it after _dl_start returns. */
|
||||
#define DL_ARGV_NOT_RELRO 1
|
|
@ -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 <jakub@redhat.com>, 2003.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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 */
|
|
@ -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, <Jes.Sorensen@cern.ch>, 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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/fpu.h>
|
||||
|
||||
/*
|
||||
* 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
|
|
@ -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 <davidm@hpl.hp.com>
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
|
||||
#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 */
|
|
@ -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
|
|
@ -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. */
|
|
@ -0,0 +1,7 @@
|
|||
/* m68k is big-endian. */
|
||||
|
||||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
|
||||
#endif
|
||||
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/m68k/sysdep.h>
|
||||
|
||||
#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__ */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#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)
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/m68k/sysdep.h>
|
||||
|
||||
#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__ */
|
|
@ -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 <maxim@codesourcery.com>, 2010.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_PTHREADTYPES_ARCH_H
|
||||
#define _BITS_PTHREADTYPES_ARCH_H 1
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <sysdep.h>
|
||||
|
||||
.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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/wordsize-32/divdi3-symbol-hacks.h>
|
||||
|
||||
#include_next "symbol-hacks.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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
|
||||
#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__ */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#if !defined _SYS_STAT_H && !defined _FCNTL_H
|
||||
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef _BITS_STAT_H
|
||||
#define _BITS_STAT_H 1
|
||||
|
||||
#include <bits/types.h>
|
||||
|
||||
/* NOTE: The size of this structure (32 ints) is known in
|
||||
<hurd/hurd_types.defs>, 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 <sys/stat.h> header.
|
||||
Therefore we have to handle the use of this header in strictly
|
||||
standard-compliant sources special. */
|
||||
struct timespec st_atim; /* Time of last access. */
|
||||
struct timespec st_mtim; /* Time of last modification. */
|
||||
struct timespec st_ctim; /* Time of last status change. */
|
||||
# define st_atime st_atim.tv_sec /* Backward compatibility. */
|
||||
# define st_mtime st_mtim.tv_sec
|
||||
# define st_ctime st_ctim.tv_sec
|
||||
#else
|
||||
__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 <sys/stat.h> header.
|
||||
Therefore we have to handle the use of this header in strictly
|
||||
standard-compliant sources special. */
|
||||
struct timespec st_atim; /* Time of last access. */
|
||||
struct timespec st_mtim; /* Time of last modification. */
|
||||
struct timespec st_ctim; /* Time of last status change. */
|
||||
#else
|
||||
__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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_TYPES_H
|
||||
# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef _BITS_TYPESIZES_H
|
||||
#define _BITS_TYPESIZES_H 1
|
||||
|
||||
/* See <bits/types.h> for the meaning of these macros. This file exists so
|
||||
that <bits/types.h> 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 */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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. */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _MACH_I386_SYSDEP_H
|
||||
#define _MACH_I386_SYSDEP_H 1
|
||||
|
||||
/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */
|
||||
#include <dl-sysdep.h>
|
||||
#include <tls.h>
|
||||
|
||||
#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 <sysdeps/mach/sysdep.h>
|
||||
|
||||
|
||||
/* This should be rearranged, but at the moment this file provides
|
||||
the most useful definitions for assembler syntax details. */
|
||||
#undef ENTRY
|
||||
#undef ALIGN
|
||||
#include <sysdeps/unix/i386/sysdep.h>
|
||||
|
||||
#endif /* mach/i386/sysdep.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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBC_LOCK_H
|
||||
#define _LIBC_LOCK_H 1
|
||||
|
||||
#ifdef _LIBC
|
||||
|
||||
#include <tls.h>
|
||||
#include <lowlevellock.h>
|
||||
|
||||
/* 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 <libc-lockP.h>
|
||||
#endif
|
||||
|
||||
#endif /* libc-lock.h */
|
|
@ -0,0 +1 @@
|
|||
/* The Mach syscalls are in <mach/syscall_sw.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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
/* Get the Mach definitions of ENTRY and kernel_trap. */
|
||||
#include <mach/machine/syscall_sw.h>
|
||||
|
||||
/* 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 <mach/mig_support.h>
|
||||
#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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
||||
corresponding to the prologues in crti.S. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
.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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BITS_PTHREADTYPES_ARCH_H
|
||||
# define _BITS_PTHREADTYPES_ARCH_H 1
|
||||
|
||||
# include <endian.h>
|
||||
|
||||
# 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. */
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
.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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
|
||||
#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__ */
|
|
@ -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 <bits/endian.h> directly; include <endian.h> instead."
|
||||
#endif
|
||||
|
||||
#ifdef __MIPSEB
|
||||
# define __BYTE_ORDER __BIG_ENDIAN
|
||||
#endif
|
||||
#ifdef __MIPSEL
|
||||
# define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Number of extra dynamic section entries for this architecture. By
|
||||
default there are none. */
|
||||
#define DT_THISPROCNUM DT_MIPS_NUM
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
|
||||
#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)
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
|
||||
#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)))
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <libc-symbols.h>
|
||||
|
||||
#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)))
|
|
@ -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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue