summaryrefslogtreecommitdiff
path: root/libc/ports/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'libc/ports/sysdeps/unix')
-rw-r--r--libc/ports/sysdeps/unix/arm/sysdep.S32
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/bits/mman.h76
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/configure13
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/configure.in12
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h63
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S9
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h76
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/clone.S13
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/configure1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/configure.in1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S8
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S8
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S21
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h47
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/vfork.S24
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h69
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/generic/bits/msq.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/bits/mman.h3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/bits/msq.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/bits/mman.h76
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/bits/msq.h6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/makecontext.c20
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h27
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/sysdep.h7
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h76
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h78
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/bits/msq.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/bits/mman.h76
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist1
41 files changed, 208 insertions, 665 deletions
diff --git a/libc/ports/sysdeps/unix/arm/sysdep.S b/libc/ports/sysdeps/unix/arm/sysdep.S
index 40e4d80ec..d82ad258a 100644
--- a/libc/ports/sysdeps/unix/arm/sysdep.S
+++ b/libc/ports/sysdeps/unix/arm/sysdep.S
@@ -37,28 +37,24 @@ __syscall_error:
#endif
#ifndef IS_IN_rtld
- mov ip, lr
- cfi_register (lr, ip)
- mov r1, r0
-
- mov r0, #0xffff0fff
- mov lr, pc
- sub pc, r0, #31
-
- ldr r2, 1f
-2: ldr r2, [pc, r2]
- str r1, [r0, r2]
- mvn r0, #0
- RETINSTR (, ip)
+ mov r1, r0
+ GET_TLS (r2)
+ ldr r2, 1f
+#ifdef __thumb__
+2: add r2, r2, pc
+ ldr r2, [r2]
+#else
+2: ldr r2, [pc, r2]
+#endif
+ str r1, [r0, r2]
+ mvn r0, #0
+ DO_RET(lr)
1: .word errno(gottpoff) + (. - 2b - PC_OFS)
#elif RTLD_PRIVATE_ERRNO
- ldr r1, 1f
-0: str r0, [pc, r1]
- mvn r0, $0
+ LDST_PCREL(str, r0, r1, C_SYMBOL_NAME(rtld_errno))
+ mvn r0, #0
DO_RET(r14)
-
-1: .word C_SYMBOL_NAME(rtld_errno) - 0b - PC_OFS
#else
#error "Unsupported non-TLS case"
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/aarch64/bits/mman.h
index 67c563ce2..770607b83 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/bits/mman.h
@@ -25,38 +25,8 @@
/* The following definitions basically come from the kernel headers.
But the kernel header is not namespace clean. */
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-#endif
-
-#ifdef __USE_MISC
/* These are Linux-specific. */
+#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
# define MAP_DENYWRITE 0x00800 /* ETXTBSY */
# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
@@ -68,47 +38,7 @@
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#endif
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
-
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
-# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
-# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
-# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
-# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
-# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
- overrides the coredump filter bits. */
-# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
-# define MADV_HWPOISON 100 /* Poison a page for testing. */
-#endif
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure b/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure
index 5a22126fe..04b6c81b6 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure
@@ -1,3 +1,16 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
arch_minimum_kernel=3.7.0
+
+test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+ /usr | /usr/)
+ libc_cv_slibdir="/lib64"
+ if test "$libdir" = '${exec_prefix}/lib'; then
+ libdir='${exec_prefix}/lib64';
+ # Locale data can be shared between 32bit and 64bit libraries
+ libc_cv_localedir='${exec_prefix}/lib/locale'
+ fi
+ ;;
+esac
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure.in b/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure.in
index d1995d486..6596a1511 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure.in
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/configure.in
@@ -2,3 +2,15 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
arch_minimum_kernel=3.7.0
+
+test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+ /usr | /usr/)
+ libc_cv_slibdir="/lib64"
+ if test "$libdir" = '${exec_prefix}/lib'; then
+ libdir='${exec_prefix}/lib64';
+ # Locale data can be shared between 32bit and 64bit libraries
+ libc_cv_localedir='${exec_prefix}/lib/locale'
+ fi
+ ;;
+esac
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist
index 031c70e8a..696158aef 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libpthread.abilist
@@ -73,7 +73,6 @@ GLIBC_2.17
pause F
pread F
pread64 F
- pthread_atfork F
pthread_attr_destroy F
pthread_attr_getaffinity_np F
pthread_attr_getdetachstate F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h
index 2238c2c72..c51b05d37 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h
@@ -51,6 +51,9 @@
# define MAP_FILE 0
# define MAP_ANONYMOUS 0x10 /* Don't use a file. */
# define MAP_ANON MAP_ANONYMOUS
+/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */
+# define MAP_HUGE_SHIFT 26
+# define MAP_HUGE_MASK 0x3f
#endif
/* Not used by Linux, but here to make sure we don't clash with
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h
index 1b07465d4..8bb057b4e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h
@@ -25,6 +25,7 @@
#define MSG_NOERROR 010000 /* no error if message is too big */
#ifdef __USE_GNU
# define MSG_EXCEPT 020000 /* recv any msg except of specified type */
+# define MSG_COPY 040000 /* copy (not remove) all queue messages */
#endif
/* Types used in the structure definition. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h
index 5dd8ae13f..a6e85f99d 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/am33/bits/mman.h
@@ -24,35 +24,6 @@
But the kernel header is not namespace clean. */
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-#endif
-
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
@@ -62,35 +33,5 @@
# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
#endif
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-#endif
-
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
-
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S b/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
index 29edec69d..6ee7a1aeb 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
@@ -53,7 +53,7 @@ longjmp_msg:
cfi_remember_state; \
cmp sp, reg; \
bls .Lok; \
- str r7, [sp, #-4]!; \
+ push { r7 }; \
cfi_adjust_cfa_offset (4); \
cfi_rel_offset (r7, 0); \
mov r5, r0; \
@@ -79,7 +79,7 @@ longjmp_msg:
.Lfail: \
add sp, sp, #12; \
cfi_adjust_cfa_offset (-12); \
- ldr r7, [sp], #4; \
+ pop { r7 }; \
cfi_adjust_cfa_offset (-4); \
cfi_restore (r7); \
CALL_FAIL \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S b/libc/ports/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S
index c4ddbc69f..21e322986 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S
@@ -41,6 +41,15 @@
.hidden __aeabi_read_tp
ENTRY (__aeabi_read_tp)
+#ifdef ARCH_HAS_HARD_TP
+ mrc p15, 0, r0, c13, c0, 3
+ bx lr
+#elif defined(__thumb2__)
+ movw r0, #0x0fe0
+ movt r0, #0xffff
+ bx r0
+#else
mov r0, #0xffff0fff
sub pc, r0, #31
+#endif
END (__aeabi_read_tp)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h
index f5ca3c9b6..11ecbca03 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/bits/mman.h
@@ -23,36 +23,6 @@
/* The following definitions basically come from the kernel headers.
But the kernel header is not namespace clean. */
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-#endif
-
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
@@ -66,47 +36,5 @@
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#endif
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
-
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
-# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
-# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
-# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
-# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
-# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
- overrides the coredump filter bits. */
-# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
-# define MADV_HWPOISON 100 /* Poison a page for testing. */
-#endif
-
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S b/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S
index 732a3ffd0..ce9c2a5ba 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S
@@ -49,7 +49,7 @@ ENTRY(__clone)
mov ip, r2
#endif
@ new sp is already in r1
- stmfd sp!, {r4, r7}
+ push {r4, r7}
cfi_adjust_cfa_offset (8)
cfi_rel_offset (r4, 0)
cfi_rel_offset (r7, 4)
@@ -61,7 +61,7 @@ ENTRY(__clone)
cfi_endproc
cmp r0, #0
beq 1f
- ldmfd sp!, {r4, r7}
+ pop {r4, r7}
blt PLTJMP(C_SYMBOL_NAME(__syscall_error))
RETINSTR(, lr)
@@ -74,17 +74,16 @@ PSEUDO_END (__clone)
#ifdef RESET_PID
tst ip, #CLONE_THREAD
bne 3f
- mov r0, #0xffff0fff
- mov lr, pc
- sub pc, r0, #31
+ GET_TLS (lr)
mov r1, r0
tst ip, #CLONE_VM
ldr r7, =SYS_ify(getpid)
ite ne
movne r0, #-1
swieq 0x0
- str r0, [r1, #PID_OFFSET]
- str r0, [r1, #TID_OFFSET]
+ NEGOFF_ADJ_BASE (r1, TID_OFFSET)
+ str r0, NEGOFF_OFF1 (r1, TID_OFFSET)
+ str r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET)
3:
#endif
@ pick the function arg and call address off the stack and execute
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/configure b/libc/ports/sysdeps/unix/sysv/linux/arm/configure
index cb94cc5eb..f66b15828 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/configure
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/configure
@@ -2,4 +2,5 @@
# Local configure fragment for sysdeps/unix/sysv/linux/arm.
libc_cv_gcc_unwind_find_fde=no
+# Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.in.
CFLAGS=${CFLAGS% -fno-unwind-tables}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in b/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in
index 3e67dee42..8fffe9405 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in
@@ -2,4 +2,5 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux/arm.
libc_cv_gcc_unwind_find_fde=no
+# Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.in.
CFLAGS=${CFLAGS% -fno-unwind-tables}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S
index 68560b065..06b737eeb 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S
@@ -23,11 +23,11 @@
ENTRY (__mmap)
/* shuffle args */
- str r5, [sp, #-4]!
+ push { r5 }
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r5, 0)
ldr r5, [sp, #8]
- str r4, [sp, #-4]!
+ push { r4 }
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r4, 0)
cfi_remember_state
@@ -43,10 +43,10 @@ ENTRY (__mmap)
/* restore registers */
2:
- ldr r4, [sp], #4
+ pop { r4 }
cfi_adjust_cfa_offset (-4)
cfi_restore (r4)
- ldr r5, [sp], #4
+ pop { r5 }
cfi_adjust_cfa_offset (-4)
cfi_restore (r5)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
index dcbab3aed..d039129b2 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
@@ -34,11 +34,11 @@
.text
ENTRY (__mmap64)
ldr ip, [sp, $LOW_OFFSET]
- str r5, [sp, #-4]!
+ push { r5 }
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r5, 0)
ldr r5, [sp, $HIGH_OFFSET]
- str r4, [sp, #-4]!
+ push { r4 }
cfi_adjust_cfa_offset (4)
cfi_rel_offset (r4, 0)
cfi_remember_state
@@ -51,7 +51,7 @@ ENTRY (__mmap64)
orr r5, ip, r5, lsl $20 @ compose page offset
DO_CALL (mmap2, 0)
cmn r0, $4096
- ldmfd sp!, {r4, r5}
+ pop {r4, r5}
cfi_adjust_cfa_offset (-8)
cfi_restore (r4)
cfi_restore (r5)
@@ -62,7 +62,7 @@ ENTRY (__mmap64)
cfi_restore_state
.Linval:
mov r0, $-EINVAL
- ldmfd sp!, {r4, r5}
+ pop {r4, r5}
cfi_adjust_cfa_offset (-8)
cfi_restore (r4)
cfi_restore (r5)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist
index 6c0bbde67..de8095a60 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libpthread.abilist
@@ -83,7 +83,6 @@ GLIBC_2.4
pause F
pread F
pread64 F
- pthread_atfork F
pthread_attr_destroy F
pthread_attr_getaffinity_np F
pthread_attr_getdetachstate F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S
index a38d56419..ca5045707 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S
@@ -19,23 +19,16 @@
/* Save the PID value. */
#define SAVE_PID \
- str lr, [sp, #-4]!; /* Save LR. */ \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (lr, 0); \
- mov r0, #0xffff0fff; /* Point to the high page. */ \
- mov lr, pc; /* Save our return address. */ \
- sub pc, r0, #31; /* Jump to the TLS entry. */ \
- ldr lr, [sp], #4; /* Restore LR. */ \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (lr); \
- mov r2, r0; /* Save the TLS addr in r2. */ \
- ldr r3, [r2, #PID_OFFSET]; /* Load the saved PID. */ \
- rsb r0, r3, #0; /* Negate it. */ \
- str r0, [r2, #PID_OFFSET] /* Store the temporary PID. */
+ GET_TLS (r2); \
+ NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET); /* Save the TLS addr in r2. */ \
+ ldr r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* Load the saved PID. */ \
+ rsb r0, r3, #0; /* Negate it. */ \
+ str r0, NEGOFF_OFF1 (r2, PID_OFFSET); /* Store the temp PID. */
/* Restore the old PID value in the parent. */
#define RESTORE_PID \
cmp r0, #0; /* If we are the parent... */ \
- strne r3, [r2, #PID_OFFSET] /* ... restore the saved PID. */
+ it ne; \
+ strne r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* restore the saved PID. */
#include "../vfork.S"
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
index df85d5199..59b826ded 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
@@ -31,7 +31,6 @@
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
.text; \
- PSEUDO_PROLOGUE; \
ENTRY (__##syscall_name##_nocancel); \
CFI_SECTIONS; \
DO_CALL (syscall_name, args); \
@@ -77,19 +76,19 @@
# define DOCARGS_0 \
.save {r7}; \
- str lr, [sp, #-4]!; \
+ push {lr}; \
cfi_adjust_cfa_offset (4); \
cfi_rel_offset (lr, 0); \
.save {lr}
# define UNDOCARGS_0
# define RESTORE_LR_0 \
- ldr lr, [sp], #4; \
+ pop {lr}; \
cfi_adjust_cfa_offset (-4); \
cfi_restore (lr)
# define DOCARGS_1 \
.save {r7}; \
- stmfd sp!, {r0, r1, lr}; \
+ push {r0, r1, lr}; \
cfi_adjust_cfa_offset (12); \
cfi_rel_offset (lr, 8); \
.save {lr}; \
@@ -103,13 +102,13 @@
# define DOCARGS_2 \
.save {r7}; \
- stmfd sp!, {r0, r1, lr}; \
+ push {r0, r1, lr}; \
cfi_adjust_cfa_offset (12); \
cfi_rel_offset (lr, 8); \
.save {lr}; \
.pad #8
# define UNDOCARGS_2 \
- ldmfd sp!, {r0, r1}; \
+ pop {r0, r1}; \
cfi_adjust_cfa_offset (-8); \
RESTART_UNWIND
# define RESTORE_LR_2 \
@@ -117,13 +116,13 @@
# define DOCARGS_3 \
.save {r7}; \
- stmfd sp!, {r0, r1, r2, r3, lr}; \
+ push {r0, r1, r2, r3, lr}; \
cfi_adjust_cfa_offset (20); \
cfi_rel_offset (lr, 16); \
.save {lr}; \
.pad #16
# define UNDOCARGS_3 \
- ldmfd sp!, {r0, r1, r2, r3}; \
+ pop {r0, r1, r2, r3}; \
cfi_adjust_cfa_offset (-16); \
RESTART_UNWIND
# define RESTORE_LR_3 \
@@ -131,13 +130,13 @@
# define DOCARGS_4 \
.save {r7}; \
- stmfd sp!, {r0, r1, r2, r3, lr}; \
+ push {r0, r1, r2, r3, lr}; \
cfi_adjust_cfa_offset (20); \
cfi_rel_offset (lr, 16); \
.save {lr}; \
.pad #16
# define UNDOCARGS_4 \
- ldmfd sp!, {r0, r1, r2, r3}; \
+ pop {r0, r1, r2, r3}; \
cfi_adjust_cfa_offset (-16); \
RESTART_UNWIND
# define RESTORE_LR_4 \
@@ -146,13 +145,13 @@
/* r4 is only stmfd'ed for correct stack alignment. */
# define DOCARGS_5 \
.save {r4, r7}; \
- stmfd sp!, {r0, r1, r2, r3, r4, lr}; \
+ push {r0, r1, r2, r3, r4, lr}; \
cfi_adjust_cfa_offset (24); \
cfi_rel_offset (lr, 20); \
.save {lr}; \
.pad #20
# define UNDOCARGS_5 \
- ldmfd sp!, {r0, r1, r2, r3}; \
+ pop {r0, r1, r2, r3}; \
cfi_adjust_cfa_offset (-16); \
.fnend; \
.fnstart; \
@@ -160,20 +159,20 @@
.save {lr}; \
.pad #4
# define RESTORE_LR_5 \
- ldmfd sp!, {r4, lr}; \
+ pop {r4, lr}; \
cfi_adjust_cfa_offset (-8); \
/* r4 will be marked as restored later. */ \
cfi_restore (lr)
# define DOCARGS_6 \
.save {r4, r5, r7}; \
- stmfd sp!, {r0, r1, r2, r3, lr}; \
+ push {r0, r1, r2, r3, lr}; \
cfi_adjust_cfa_offset (20); \
cfi_rel_offset (lr, 16); \
.save {lr}; \
.pad #16
# define UNDOCARGS_6 \
- ldmfd sp!, {r0, r1, r2, r3}; \
+ pop {r0, r1, r2, r3}; \
cfi_adjust_cfa_offset (-16); \
.fnend; \
.fnstart; \
@@ -203,12 +202,8 @@ extern int __local_multiple_threads attribute_hidden;
# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
# define SINGLE_THREAD_P \
- ldr ip, 1b; \
- 2: \
- ldr ip, [pc, ip]; \
- teq ip, #0;
-# define PSEUDO_PROLOGUE \
- 1: .word __local_multiple_threads - 2f - PC_OFS;
+ LDST_PCREL(ldr, ip, ip, __local_multiple_threads); \
+ teq ip, #0
# endif
# else
/* There is no __local_multiple_threads for librt, so use the TCB. */
@@ -217,14 +212,14 @@ extern int __local_multiple_threads attribute_hidden;
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
# else
-# define PSEUDO_PROLOGUE
# define SINGLE_THREAD_P \
- stmfd sp!, {r0, lr}; \
+ push {r0, lr}; \
cfi_adjust_cfa_offset (8); \
cfi_rel_offset (lr, 4); \
- bl __aeabi_read_tp; \
- ldr ip, [r0, #MULTIPLE_THREADS_OFFSET]; \
- ldmfd sp!, {r0, lr}; \
+ GET_TLS (lr); \
+ NEGOFF_ADJ_BASE (r0, MULTIPLE_THREADS_OFFSET); \
+ ldr ip, NEGOFF_OFF1 (r0, MULTIPLE_THREADS_OFFSET); \
+ pop {r0, lr}; \
cfi_adjust_cfa_offset (-8); \
cfi_restore (lr); \
teq ip, #0
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
index caa6a2626..108924d8b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
@@ -93,7 +93,7 @@ asm (
"_Unwind_Resume:\n"
" .cfi_sections .debug_frame\n"
" " CFI_STARTPROC "\n"
-" stmfd sp!, {r4, r5, r6, lr}\n"
+" push {r4, r5, r6, lr}\n"
" " CFI_ADJUST_CFA_OFFSET (16)" \n"
" " CFI_REL_OFFSET (r4, 0) "\n"
" " CFI_REL_OFFSET (r5, 4) "\n"
@@ -108,7 +108,7 @@ asm (
" cmp r3, #0\n"
" beq 4f\n"
"5: mov r0, r6\n"
-" ldmfd sp!, {r4, r5, r6, lr}\n"
+" pop {r4, r5, r6, lr}\n"
" " CFI_ADJUST_CFA_OFFSET (-16) "\n"
" " CFI_RESTORE (r4) "\n"
" " CFI_RESTORE (r5) "\n"
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
index 121159913..d155ea7dc 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
@@ -56,7 +56,7 @@ asm (
"_Unwind_Resume:\n"
" .cfi_sections .debug_frame\n"
" " CFI_STARTPROC "\n"
-" stmfd sp!, {r4, r5, r6, lr}\n"
+" push {r4, r5, r6, lr}\n"
" " CFI_ADJUST_CFA_OFFSET (16)" \n"
" " CFI_REL_OFFSET (r4, 0) "\n"
" " CFI_REL_OFFSET (r5, 4) "\n"
@@ -71,7 +71,7 @@ asm (
" cmp r3, #0\n"
" beq 4f\n"
"5: mov r0, r6\n"
-" ldmfd sp!, {r4, r5, r6, lr}\n"
+" pop {r4, r5, r6, lr}\n"
" " CFI_ADJUST_CFA_OFFSET (-16) "\n"
" " CFI_RESTORE (r4) "\n"
" " CFI_RESTORE (r5) "\n"
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/vfork.S b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/vfork.S
index 3fce2d1af..216fb2d2e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/vfork.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/vfork.S
@@ -19,24 +19,18 @@
/* Save the PID value. */
#define SAVE_PID \
- str lr, [sp, #-4]!; /* Save LR. */ \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (lr, 0); \
- mov r0, #0xffff0fff; /* Point to the high page. */ \
- mov lr, pc; /* Save our return address. */ \
- sub pc, r0, #31; /* Jump to the TLS entry. */ \
- ldr lr, [sp], #4; /* Restore LR. */ \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (lr); \
- mov r2, r0; /* Save the TLS addr in r2. */ \
- ldr r3, [r2, #PID_OFFSET]; /* Load the saved PID. */ \
- rsbs r0, r3, #0; /* Negate it. */ \
- moveq r0, #0x80000000; /* Use 0x80000000 if it was 0. */ \
- str r0, [r2, #PID_OFFSET] /* Store the temporary PID. */
+ GET_TLS (r2); \
+ NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET); /* Save the TLS addr in r2. */ \
+ ldr r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* Load the saved PID. */ \
+ rsbs r0, r3, #0; /* Negate it. */ \
+ it eq; \
+ moveq r0, #0x80000000; /* Use 0x80000000 if it was 0. */ \
+ str r0, NEGOFF_OFF1 (r2, PID_OFFSET); /* Store the temp PID. */
/* Restore the old PID value in the parent. */
#define RESTORE_PID \
cmp r0, #0; /* If we are the parent... */ \
- strne r3, [r2, #PID_OFFSET] /* ... restore the saved PID. */
+ it ne; \
+ strne r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* restore the saved PID. */
#include "../vfork.S"
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S b/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S
index 665ecb4de..bdd5a52be 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S
@@ -23,7 +23,7 @@
ENTRY (syscall)
mov ip, sp
- stmfd sp!, {r4, r5, r6, r7}
+ push {r4, r5, r6, r7}
cfi_adjust_cfa_offset (16)
cfi_rel_offset (r4, 0)
cfi_rel_offset (r5, 4)
@@ -35,7 +35,7 @@ ENTRY (syscall)
mov r2, r3
ldmfd ip, {r3, r4, r5, r6}
swi 0x0
- ldmfd sp!, {r4, r5, r6, r7}
+ pop {r4, r5, r6, r7}
cfi_adjust_cfa_offset (-16)
cfi_restore (r4)
cfi_restore (r5)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
index f40cb95e8..b195d8ea1 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -45,6 +45,38 @@
#ifdef __ASSEMBLER__
+#ifndef ARCH_HAS_HARD_TP
+/* Internal macro calling the linux kernel kuser_get_tls helper.
+ Note that in thumb mode, a constant pool break is often out of range, so
+ we always expand the constant inline. */
+# ifdef __thumb2__
+# define GET_TLS_BODY \
+ movw r0, #0x0fe0; \
+ movt r0, #0xffff; \
+ blx r0
+# else
+# define GET_TLS_BODY \
+ mov r0, #0xffff0fff; /* Point to the high page. */ \
+ mov lr, pc; /* Save our return address. */ \
+ sub pc, r0, #31 /* Jump to the TLS entry. */
+# endif
+
+/* Helper to get the TLS base pointer. Save LR in TMP, return in R0,
+ and no other registers clobbered. TMP may be LR itself to indicate
+ that no save is necessary. */
+# undef GET_TLS
+# define GET_TLS(TMP) \
+ .ifnc TMP, lr; \
+ mov TMP, lr; \
+ cfi_register (lr, TMP); \
+ GET_TLS_BODY; \
+ mov lr, TMP; \
+ cfi_restore (lr); \
+ .else; \
+ GET_TLS_BODY; \
+ .endif
+#endif /* ARCH_HAS_HARD_TP */
+
/* Linux uses a negative return value to indicate syscall errors,
unlike most Unices, which use the condition codes' carry flag.
@@ -110,32 +142,29 @@
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
__local_syscall_error: \
- ldr r1, 1f; \
- rsb r0, r0, #0; \
-0: str r0, [pc, r1]; \
- mvn r0, #0; \
- DO_RET(lr); \
-1: .word C_SYMBOL_NAME(rtld_errno) - 0b - PC_OFS;
+ rsb r0, r0, #0; \
+ LDST_PCREL(str, r0, r1, C_SYMBOL_NAME(rtld_errno)); \
+ mvn r0, #0; \
+ DO_RET(lr)
# else
# if defined(__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__)
# define POP_PC \
- ldr lr, [sp], #4; \
+ pop { lr }; \
cfi_adjust_cfa_offset (-4); \
cfi_restore (lr); \
bx lr
# else
-# define POP_PC \
- ldr pc, [sp], #4
+# define POP_PC pop { pc }
# endif
# define SYSCALL_ERROR_HANDLER \
__local_syscall_error: \
- str lr, [sp, #-4]!; \
+ push { lr }; \
cfi_adjust_cfa_offset (4); \
cfi_rel_offset (lr, 0); \
- str r0, [sp, #-4]!; \
+ push { r0 }; \
cfi_adjust_cfa_offset (4); \
bl PLTJMP(C_SYMBOL_NAME(__errno_location)); \
- ldr r1, [sp], #4; \
+ pop { r1 }; \
cfi_adjust_cfa_offset (-4); \
rsb r1, r1, #0; \
str r1, [r0]; \
@@ -202,7 +231,7 @@ __local_syscall_error: \
#undef DOARGS_0
#define DOARGS_0 \
.fnstart; \
- str r7, [sp, #-4]!; \
+ push { r7 }; \
cfi_adjust_cfa_offset (4); \
cfi_rel_offset (r7, 0); \
.save { r7 }
@@ -217,7 +246,7 @@ __local_syscall_error: \
#undef DOARGS_5
#define DOARGS_5 \
.fnstart; \
- stmfd sp!, {r4, r7}; \
+ push {r4, r7}; \
cfi_adjust_cfa_offset (8); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r7, 4); \
@@ -227,7 +256,7 @@ __local_syscall_error: \
#define DOARGS_6 \
.fnstart; \
mov ip, sp; \
- stmfd sp!, {r4, r5, r7}; \
+ push {r4, r5, r7}; \
cfi_adjust_cfa_offset (12); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r5, 4); \
@@ -238,7 +267,7 @@ __local_syscall_error: \
#define DOARGS_7 \
.fnstart; \
mov ip, sp; \
- stmfd sp!, {r4, r5, r6, r7}; \
+ push {r4, r5, r6, r7}; \
cfi_adjust_cfa_offset (16); \
cfi_rel_offset (r4, 0); \
cfi_rel_offset (r5, 4); \
@@ -249,7 +278,7 @@ __local_syscall_error: \
#undef UNDOARGS_0
#define UNDOARGS_0 \
- ldr r7, [sp], #4; \
+ pop {r7}; \
cfi_adjust_cfa_offset (-4); \
cfi_restore (r7); \
.fnend
@@ -263,14 +292,14 @@ __local_syscall_error: \
#define UNDOARGS_4 UNDOARGS_0
#undef UNDOARGS_5
#define UNDOARGS_5 \
- ldmfd sp!, {r4, r7}; \
+ pop {r4, r7}; \
cfi_adjust_cfa_offset (-8); \
cfi_restore (r4); \
cfi_restore (r7); \
.fnend
#undef UNDOARGS_6
#define UNDOARGS_6 \
- ldmfd sp!, {r4, r5, r7}; \
+ pop {r4, r5, r7}; \
cfi_adjust_cfa_offset (-12); \
cfi_restore (r4); \
cfi_restore (r5); \
@@ -278,7 +307,7 @@ __local_syscall_error: \
.fnend
#undef UNDOARGS_7
#define UNDOARGS_7 \
- ldmfd sp!, {r4, r5, r6, r7}; \
+ pop {r4, r5, r6, r7}; \
cfi_adjust_cfa_offset (-16); \
cfi_restore (r4); \
cfi_restore (r5); \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S b/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S
index ae931f79c..128a6402b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -37,7 +37,7 @@ ENTRY (__vfork)
mov ip, r7
cfi_register (r7, ip)
.fnstart
- str r7, [sp, #-4]!
+ push { r7 }
cfi_adjust_cfa_offset (4)
.save { r7 }
ldr r7, =SYS_ify (vfork)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/generic/bits/msq.h b/libc/ports/sysdeps/unix/sysv/linux/generic/bits/msq.h
index 87f37b4d6..49cbf0611 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/generic/bits/msq.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/generic/bits/msq.h
@@ -27,6 +27,7 @@
#define MSG_NOERROR 010000 /* no error if message is too big */
#ifdef __USE_GNU
# define MSG_EXCEPT 020000 /* recv any msg except of specified type */
+# define MSG_COPY 040000 /* copy (not remove) all queue messages */
#endif
/* Types used in the structure definition. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/mman.h
index c216ddb1f..2835b0ff0 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/mman.h
@@ -44,6 +44,9 @@
# define MAP_ANONYMOUS 0x10 /* Don't use a file */
# define MAP_ANON MAP_ANONYMOUS
# define MAP_VARIABLE 0
+/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */
+# define MAP_HUGE_SHIFT 26
+# define MAP_HUGE_MASK 0x3f
#endif
/* These are Linux-specific. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/msq.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/msq.h
index e56286b28..ac35f510b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/msq.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/msq.h
@@ -26,6 +26,7 @@
#define MSG_NOERROR 010000 /* no error if message is too big */
#ifdef __USE_GNU
# define MSG_EXCEPT 020000 /* recv any msg except of specified type */
+# define MSG_COPY 040000 /* copy (not remove) all queue messages */
#endif
/* Types used in the structure definition. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/mman.h
index fba16db47..c3b1caf9d 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/mman.h
@@ -23,36 +23,6 @@
/* The following definitions basically come from the kernel headers.
But the kernel header is not namespace clean. */
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-#endif
-
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
@@ -67,47 +37,5 @@
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#endif
-/* Flags to `msync'. */
-#define MS_ASYNC 0x1 /* Sync memory asynchronously. */
-#define MS_INVALIDATE 0x2 /* Invalidate the caches. */
-#define MS_SYNC 0x4 /* Synchronous memory sync. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 0x1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 0x2 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
-
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
-# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
-# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
-# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
-# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
-# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
- overrides the coredump filter bits. */
-# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
-# define MADV_HWPOISON 100 /* Poison a page for testing. */
-#endif
-
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/msq.h b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/msq.h
index 68d3ed792..8519390c4 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/msq.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/msq.h
@@ -24,8 +24,10 @@
/* Define options for message queue functions. */
#define MSG_NOERROR 010000 /* no error if message is too big */
-#define MSG_EXCEPT 020000 /* recv any msg except of specified type */
-
+#ifdef __USE_GNU
+# define MSG_EXCEPT 020000 /* recv any msg except of specified type */
+# define MSG_COPY 040000 /* copy (not remove) all queue messages */
+#endif
/* Structure of record for one message inside the kernel.
The type `struct __msg' is opaque. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/makecontext.c b/libc/ports/sysdeps/unix/sysv/linux/ia64/makecontext.c
index 79fa05af6..c3bb5de19 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/makecontext.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/makecontext.c
@@ -22,14 +22,10 @@
#include <stdlib.h>
#include <ucontext.h>
#include <sys/rse.h>
+#include <link.h>
+#include <dl-fptr.h>
-struct fdesc
- {
- unsigned long ip;
- unsigned long gp;
- };
-
#define PUSH(val) \
do { \
if (ia64_rse_is_rnat_slot (rbs)) \
@@ -48,7 +44,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
extern void __start_context (ucontext_t *link, long gp, ...);
unsigned long stack_start, stack_end;
va_list ap;
- long *rbs;
+ unsigned long *rbs;
int i;
stack_start = (long) sc->sc_stack.ss_sp;
@@ -65,16 +61,16 @@ makecontext: does not know how to handle more than 8 arguments\n"));
}
/* set the entry point and global pointer: */
- sc->sc_br[0] = ((struct fdesc *) &__start_context)->ip;
- sc->sc_br[1] = ((struct fdesc *) func)->ip;
- sc->sc_gr[1] = ((struct fdesc *) func)->gp;
+ sc->sc_br[0] = ELF_PTR_TO_FDESC (&__start_context)->ip;
+ sc->sc_br[1] = ELF_PTR_TO_FDESC (func)->ip;
+ sc->sc_gr[1] = ELF_PTR_TO_FDESC (func)->gp;
/* set up the call frame: */
sc->sc_ar_pfs = ((sc->sc_ar_pfs & ~0x3fffffffffUL)
| (argc + 2) | ((argc + 2) << 7));
- rbs = (long *) stack_start;
+ rbs = (unsigned long *) stack_start;
PUSH((long) ucp->uc_link);
- PUSH(((struct fdesc *) &__start_context)->gp);
+ PUSH(ELF_PTR_TO_FDESC (&__start_context)->gp);
va_start (ap, argc);
for (i = 0; i < argc; ++i)
PUSH(va_arg (ap, long));
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h
index e87b0fe69..886a4f0e5 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h
@@ -16,22 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _DL_SYSDEP_H
-#define _DL_SYSDEP_H 1
+#ifndef _LINUX_IA64_DL_SYSDEP_H
+#define _LINUX_IA64_DL_SYSDEP_H 1
-/* 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. */
-
-#ifdef IS_IN_rtld
-# define RTLD_PRIVATE_ERRNO 1
-#else
-# define RTLD_PRIVATE_ERRNO 0
-#endif
+#include_next <dl-sysdep.h>
/* Traditionally system calls have been made using break 0x100000. A
second method was introduced which, if possible, will use the EPC
@@ -41,7 +29,7 @@
#define NEED_DL_SYSINFO 1
#define USE_DL_SYSINFO 1
-#if defined NEED_DL_SYSINFO && !defined __ASSEMBLER__
+#ifndef __ASSEMBLER__
/* Don't declare this as a function---we want it's entry-point, not
it's function descriptor... */
extern int _dl_sysinfo_break attribute_hidden;
@@ -64,11 +52,4 @@ extern int _dl_sysinfo_break attribute_hidden;
might write into it after _dl_start returns. */
#define DL_ARGV_NOT_RELRO 1
-
-#ifndef __ASSEMBLER__
-/* Get version of the OS. */
-extern int _dl_discover_osversion (void) attribute_hidden;
-# define HAVE_DL_DISCOVER_OSVERSION 1
-#endif
-
#endif /* dl-sysdep.h */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/ia64/sysdep.h
index c6fce1313..96f6a4e8a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -252,7 +252,7 @@
_retval; })
#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long int err
+#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused))
#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
@@ -264,7 +264,10 @@
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1)
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ({ (void) (val); \
+ (err == -1); \
+ })
#undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h
index d2fb69d83..b89011aee 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h
@@ -23,36 +23,6 @@
/* The following definitions basically come from the kernel headers.
But the kernel header is not namespace clean. */
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-#endif
-
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
@@ -66,47 +36,5 @@
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#endif
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
-
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
-# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
-# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
-# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
-# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
-# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
- overrides the coredump filter bits. */
-# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
-# define MADV_HWPOISON 100 /* Poison a page for testing. */
-#endif
-
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist
index 6c0bbde67..de8095a60 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libpthread.abilist
@@ -83,7 +83,6 @@ GLIBC_2.4
pause F
pread F
pread64 F
- pthread_atfork F
pthread_attr_destroy F
pthread_attr_getaffinity_np F
pthread_attr_getdetachstate F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h
index a13a90096..b327795f8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/mman.h
@@ -23,41 +23,9 @@
/* The following definitions basically come from the kernel headers.
But the kernel header is not namespace clean. */
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x0800 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-# define MAP_RENAME MAP_ANONYMOUS
-#endif
-
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_NORESERVE 0x0400 /* don't check for reservations */
-# define MAP_ANONYMOUS 0x0800 /* don't use a file */
# define MAP_GROWSDOWN 0x1000 /* stack-like segment */
# define MAP_DENYWRITE 0x2000 /* ETXTBSY */
# define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
@@ -68,47 +36,11 @@
# define MAP_HUGETLB 0x80000 /* Create huge page mapping. */
#endif
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
+#define __MAP_ANONYMOUS 0x0800
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
-# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
-# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
-# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
-# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
-# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
- overrides the coredump filter bits. */
-# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
-# define MADV_HWPOISON 100 /* Poison a page for testing. */
-#endif
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
+#ifdef __USE_MISC
+# define MAP_RENAME MAP_ANONYMOUS
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/msq.h b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/msq.h
index 8439069cd..e814bc722 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/bits/msq.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/bits/msq.h
@@ -25,6 +25,7 @@
#define MSG_NOERROR 010000 /* no error if message is too big */
#ifdef __USE_GNU
# define MSG_EXCEPT 020000 /* recv any msg except of specified type */
+# define MSG_COPY 040000 /* copy (not remove) all queue messages */
#endif
/* Types used in the structure definition. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/bits/mman.h b/libc/ports/sysdeps/unix/sysv/linux/tile/bits/mman.h
index 7494ee5e5..02fddecc1 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/bits/mman.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/bits/mman.h
@@ -23,36 +23,6 @@
/* The following definitions basically come from the kernel headers.
But the kernel header is not namespace clean. */
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-#endif
-
#ifdef __USE_MISC
/* These are Linux-specific. */
# define MAP_NONBLOCK 0x00080 /* Do not block on IO. */
@@ -66,47 +36,5 @@
# define MAP_HUGETLB 0x04000 /* Create huge page mapping. */
#endif
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
-
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
-# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
-# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
-# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */
-# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */
-# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
- overrides the coredump filter bits. */
-# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
-# define MADV_HWPOISON 100 /* Poison a page for testing. */
-#endif
-
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
+/* Include generic Linux declarations. */
+#include <bits/mman-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist
index 3ab004605..658c4bf99 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libpthread.abilist
@@ -73,7 +73,6 @@ GLIBC_2.12
pause F
pread F
pread64 F
- pthread_atfork F
pthread_attr_destroy F
pthread_attr_getaffinity_np F
pthread_attr_getdetachstate F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist
index 3ab004605..658c4bf99 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libpthread.abilist
@@ -73,7 +73,6 @@ GLIBC_2.12
pause F
pread F
pread64 F
- pthread_atfork F
pthread_attr_destroy F
pthread_attr_getaffinity_np F
pthread_attr_getdetachstate F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist
index 3ab004605..658c4bf99 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libpthread.abilist
@@ -73,7 +73,6 @@ GLIBC_2.12
pause F
pread F
pread64 F
- pthread_atfork F
pthread_attr_destroy F
pthread_attr_getaffinity_np F
pthread_attr_getdetachstate F