diff mbox

[20/27,AARCH64] Make lp64 and ilp32 directories.

Message ID 1466485631-3532-22-git-send-email-ynorov@caviumnetworks.com
State New
Headers show

Commit Message

Yury Norov June 21, 2016, 5:07 a.m. UTC
From: Andrew Pinski <apinski@cavium.com>


The patch makes the ilp32 and lp64 have their own directory under aarch64.
Since ILP32 uses most of the same system calls as LP64 and has a 64bit
off_t, we need make the functions that end in 64 the same as the ones without.
We also need not to special case ioctl or use the already provided mmap.c file.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>

---
 sysdeps/aarch64/Implies                            |  6 --
 sysdeps/aarch64/ilp32/Implies                      |  6 ++
 sysdeps/aarch64/lp64/Implies                       |  7 ++
 sysdeps/unix/sysv/linux/aarch64/Implies            |  2 -
 sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h       |  6 +-
 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   | 26 ++++++--
 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies      |  4 ++
 .../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c  |  6 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c |  6 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   | 78 ++++++++++++++++++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c    |  0
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c     |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c     | 32 +++++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c     |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c   |  5 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c    |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c  |  5 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c     | 53 +++++++++++++++
 .../unix/sysv/linux/aarch64/ilp32/shlib-versions   |  7 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c     | 32 +++++++++
 .../unix/sysv/linux/aarch64/ilp32/syscalls.list    |  0
 sysdeps/unix/sysv/linux/aarch64/ioctl.S            | 31 ---------
 sysdeps/unix/sysv/linux/aarch64/lp64/Implies       |  4 ++
 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S       | 31 +++++++++
 sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c        | 34 ++++++++++
 .../unix/sysv/linux/aarch64/lp64/shlib-versions    |  7 ++
 sysdeps/unix/sysv/linux/aarch64/mmap.c             | 34 ----------
 sysdeps/unix/sysv/linux/aarch64/shlib-versions     |  7 --
 30 files changed, 346 insertions(+), 88 deletions(-)
 delete mode 100644 sysdeps/aarch64/Implies
 create mode 100644 sysdeps/aarch64/ilp32/Implies
 create mode 100644 sysdeps/aarch64/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/mmap.c
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/shlib-versions

-- 
2.7.4

Comments

Andreas Schwab June 21, 2016, 8:12 a.m. UTC | #1
Yury Norov <ynorov@caviumnetworks.com> writes:

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c

> new file mode 100644

> index 0000000..0f89a09

> --- /dev/null

> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c

> @@ -0,0 +1,78 @@

> +/* Copyright (C) 2007-2015 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 <dirent.h>

> +#include <stddef.h>

> +#include <stdint.h>

> +#include <string.h>

> +#include <unistd.h>

> +#include <sys/types.h>

> +#include <bits/wordsize.h>

> +

> +#include <sysdep.h>

> +#include <sys/syscall.h>

> +#include <linux/posix_types.h>

> +

> +struct kernel_dirent64

> +  {

> +    uint64_t		d_ino;

> +    int64_t		d_off;

> +    unsigned short int	d_reclen;

> +    unsigned char	d_type;

> +    char		d_name[256];

> +  };

> +

> +static size_t conv (char *buf, size_t nbytes)

> +{

> +	char *end = buf + nbytes;

> +	struct dirent *u = (struct dirent *) buf;

> +	struct kernel_dirent64 *k = (struct kernel_dirent64 *) buf;

> +	size_t sizd = offsetof(struct kernel_dirent64, d_name)

> +		  - offsetof(struct dirent, d_name);

> +

> +	while ((char*) k < end)

> +	{

> +	  struct kernel_dirent64 *nk = (char *) k + k->d_reclen;

> +	  size_t name_len = k->d_reclen - offsetof(struct kernel_dirent64, d_name);

> +

> +	  u->d_ino = k->d_ino;

> +	  u->d_off = k->d_off;

> +	  u->d_reclen = k->d_reclen - sizd;

> +	  u->d_type = k->d_type;

> +	  memcpy (u->d_name, k->d_name, name_len);

> +

> +	  u = (char *) u + u->d_reclen;

> +	  k = nk;

> +	}

> +

> +	return (size_t) u - (size_t) buf;

> +}

> +

> +ssize_t

> +__getdents (int fd, char *buf, size_t nbytes)

> +{

> +

> +  struct kernel_dirent64 *k;


Unused variable.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Joseph Myers June 21, 2016, 10:44 a.m. UTC | #2
On Tue, 21 Jun 2016, Yury Norov wrote:

> From: Andrew Pinski <apinski@cavium.com>

> 

> The patch makes the ilp32 and lp64 have their own directory under aarch64.

> Since ILP32 uses most of the same system calls as LP64 and has a 64bit

> off_t, we need make the functions that end in 64 the same as the ones without.

> We also need not to special case ioctl or use the already provided mmap.c file.


My previous comments at 
<https://sourceware.org/ml/libc-alpha/2014-10/msg00640.html> apply.  Where 
are your ABI test baselines?

> diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies

> new file mode 100644

> index 0000000..705bc5b

> --- /dev/null

> +++ b/sysdeps/aarch64/ilp32/Implies

> @@ -0,0 +1,6 @@

> +aarch64

> +wordsize-32

> +ieee754/ldbl-128

> +ieee754/dbl-64

> +ieee754/flt-32

> +aarch64/soft-fp


You can use ieee754/dbl-64/wordsize-64 here.  See my commit 
b75bc69cdfe5247b2156ce249518f1c1df4d797d.

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c


The formatting in this file is thoroughly wrong.

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c

> new file mode 100644

> index 0000000..b5b9994

> --- /dev/null

> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c

> @@ -0,0 +1 @@

> +/* See preadv.c */

> \ No newline at end of file


All files should have final newlines (but with Adhemerval's preadv 
unification, you shouldn't need this; make the unified version more 
general if necessary).

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions

> new file mode 100644

> index 0000000..17db764

> --- /dev/null

> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions

> @@ -0,0 +1,7 @@

> +DEFAULT			GLIBC_2.21


No, GLIBC_2.24 if this gets in by the end of June, GLIBC_2.25 otherwise 
(since glibc is frozen for release during July).  The symbol version is 
always the version of the first release with the new port.

-- 
Joseph S. Myers
joseph@codesourcery.com
diff mbox

Patch

diff --git a/sysdeps/aarch64/Implies b/sysdeps/aarch64/Implies
deleted file mode 100644
index e5adf4d..0000000
--- a/sysdeps/aarch64/Implies
+++ /dev/null
@@ -1,6 +0,0 @@ 
-wordsize-64
-ieee754/ldbl-128
-ieee754/dbl-64/wordsize-64
-ieee754/dbl-64
-ieee754/flt-32
-aarch64/soft-fp
diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies
new file mode 100644
index 0000000..705bc5b
--- /dev/null
+++ b/sysdeps/aarch64/ilp32/Implies
@@ -0,0 +1,6 @@ 
+aarch64
+wordsize-32
+ieee754/ldbl-128
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git a/sysdeps/aarch64/lp64/Implies b/sysdeps/aarch64/lp64/Implies
new file mode 100644
index 0000000..d2fbde7
--- /dev/null
+++ b/sysdeps/aarch64/lp64/Implies
@@ -0,0 +1,7 @@ 
+aarch64
+wordsize-64
+ieee754/ldbl-128
+ieee754/dbl-64/wordsize-64
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git a/sysdeps/unix/sysv/linux/aarch64/Implies b/sysdeps/unix/sysv/linux/aarch64/Implies
index 4409e19..c508f2e 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Implies
+++ b/sysdeps/unix/sysv/linux/aarch64/Implies
@@ -1,3 +1 @@ 
 aarch64/nptl
-unix/sysv/linux/generic
-unix/sysv/linux/wordsize-64
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
index 658f696..7dcbe65 100644
--- a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
@@ -25,7 +25,11 @@ 
 #define __O_NOFOLLOW	0100000
 #define __O_DIRECT	0200000
 
-#define __O_LARGEFILE	0
+#ifdef __ILP32__
+# define __O_LARGEFILE	0400000
+#else
+# define __O_LARGEFILE	0
+#endif
 
 # define F_GETLK64	5
 # define F_SETLK64	6
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
index 844da49..cd66504 100644
--- a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
@@ -29,7 +29,7 @@ 
 #define __DEV_T_TYPE		__UQUAD_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
-#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO_T_TYPE		__UQUAD_TYPE
 #define __INO64_T_TYPE		__UQUAD_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__U32_TYPE
@@ -38,11 +38,11 @@ 
 #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	__BLKCNT_T_TYPE		__SQUAD_TYPE
 #define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
-#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT_T_TYPE	__UQUAD_TYPE
 #define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
-#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT_T_TYPE	__UQUAD_TYPE
 #define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
@@ -62,14 +62,26 @@ 
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE         __ULONGWORD_TYPE
 
-#ifdef __LP64__
 /* Tell the libc code that off_t and off64_t are actually the same type
    for all ABI purposes, even if possibly expressed as different base types
    for C type-checking purposes.  */
-# define __OFF_T_MATCHES_OFF64_T	1
+# define __OFF_T_MATCHES_OFF64_T			1
 
 /* Same for ino_t and ino64_t.  */
-# define __INO_T_MATCHES_INO64_T	1
+# define __INO_T_MATCHES_INO64_T			1
+
+/* And for __blkcnt_t and __blkcnt64_t.  */
+# define __BLKCNT_T_TYPE_MATCHES_BLKCNT64_T_TYPE	1
+
+/* And for __fsblkcnt_t and __fsblkcnt64_t.  */
+# define __FSBLKCNT_T_TYPE_MATCHES_FSBLKCNT64_T_TYPE	1
+
+/* And for __fsbilcnt_t and __fsbilcnt64_t.  */
+# define __FSFILCNT_T_TYPE_MATCHES_FSFILCNT64_T_TYPE	1
+
+#if __WORDSIZE == 32
+/* And struct timespec needs pads.  */
+# define timespec_needs_pads	1
 #endif
 
 /* Number of descriptors that can fit in an `fd_set'.  */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies b/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
new file mode 100644
index 0000000..151f0e4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
@@ -0,0 +1,4 @@ 
+aarch64/nptl
+unix/sysv/linux/aarch64
+unix/sysv/linux/generic
+unix/sysv/linux/generic/wordsize-32
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
new file mode 100644
index 0000000..9a17a9b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
@@ -0,0 +1,6 @@ 
+/* In this implementation we do not really care whether the call fails
+   because of missing kernel support since we do not even call the
+   function in this case.  */
+#undef __ASSUME_ATFCTS
+#define __ASSUME_ATFCTS 1
+#include "fxstatat64.c"
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c
new file mode 100644
index 0000000..e77b753
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c
@@ -0,0 +1,6 @@ 
+/* In this implementation we do not really care whether the call fails
+   because of missing kernel support since we do not even call the
+   function in this case.  */
+#undef __ASSUME_ATFCTS
+#define __ASSUME_ATFCTS 1
+#include "xstat64.c"
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
new file mode 100644
index 0000000..0f89a09
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
@@ -0,0 +1,78 @@ 
+/* Copyright (C) 2007-2015 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 <dirent.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <linux/posix_types.h>
+
+struct kernel_dirent64
+  {
+    uint64_t		d_ino;
+    int64_t		d_off;
+    unsigned short int	d_reclen;
+    unsigned char	d_type;
+    char		d_name[256];
+  };
+
+static size_t conv (char *buf, size_t nbytes)
+{
+	char *end = buf + nbytes;
+	struct dirent *u = (struct dirent *) buf;
+	struct kernel_dirent64 *k = (struct kernel_dirent64 *) buf;
+	size_t sizd = offsetof(struct kernel_dirent64, d_name)
+		  - offsetof(struct dirent, d_name);
+
+	while ((char*) k < end)
+	{
+	  struct kernel_dirent64 *nk = (char *) k + k->d_reclen;
+	  size_t name_len = k->d_reclen - offsetof(struct kernel_dirent64, d_name);
+
+	  u->d_ino = k->d_ino;
+	  u->d_off = k->d_off;
+	  u->d_reclen = k->d_reclen - sizd;
+	  u->d_type = k->d_type;
+	  memcpy (u->d_name, k->d_name, name_len);
+
+	  u = (char *) u + u->d_reclen;
+	  k = nk;
+	}
+
+	return (size_t) u - (size_t) buf;
+}
+
+ssize_t
+__getdents (int fd, char *buf, size_t nbytes)
+{
+
+  struct kernel_dirent64 *k;
+  int ret;
+
+  ret = INLINE_SYSCALL (getdents64, 3, fd, buf, nbytes);
+  if (ret == -1)
+	  return ret;
+
+  return conv(buf, ret);
+}
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
new file mode 100644
index 0000000..9686730
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
@@ -0,0 +1 @@ 
+#include <sysdeps/unix/sysv/linux/generic/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c
new file mode 100644
index 0000000..e69de29
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
new file mode 100644
index 0000000..6f1a141
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
@@ -0,0 +1 @@ 
+#include <sysdeps/unix/sysv/linux/mmap64.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c
new file mode 100644
index 0000000..caa9f36
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c
@@ -0,0 +1,32 @@ 
+/* Copyright (C) 2007-2015 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 <errno.h>
+#include <sys/msg.h>
+#include <ipc_priv.h>
+#include <sysdep.h>
+
+int __msgctl (int msqid, int cmd, struct msqid_ds *buf);
+
+int
+__msgctl (int msqid, int cmd, struct msqid_ds *buf)
+{
+  return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
+}
+
+#include <shlib-compat.h>
+versioned_symbol (libc, __msgctl, msgctl, GLIBC_2_0);
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
new file mode 100644
index 0000000..b5b9994
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
@@ -0,0 +1 @@ 
+/* See preadv.c */
\ No newline at end of file
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
new file mode 100644
index 0000000..72bfc63
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
@@ -0,0 +1,5 @@ 
+#include <sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c>
+
+weak_alias (__libc_preadv64, __libc_preadv)
+weak_alias (__libc_preadv64, __preadv)
+weak_alias (__libc_preadv64, preadv)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c
new file mode 100644
index 0000000..298a33e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c
@@ -0,0 +1 @@ 
+/* Implemented in sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
new file mode 100644
index 0000000..61dbd18
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
@@ -0,0 +1,5 @@ 
+#include <sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev64.c>
+
+weak_alias (__libc_pwritev64, __libc_pwritev)
+weak_alias (__libc_pwritev64, __pwritev)
+weak_alias (__libc_pwritev64, pwritev)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c
new file mode 100644
index 0000000..5263dcb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c
@@ -0,0 +1 @@ 
+#include <sysdeps/unix/sysv/linux/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
new file mode 100644
index 0000000..0c90527
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
@@ -0,0 +1,53 @@ 
+/* Copyright (C) 2007-2016 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 <errno.h>
+#include <stdarg.h>
+#include <sys/sem.h>
+#include <ipc_priv.h>
+#include <sysdep.h>
+
+/* Define a `union semun' that is for glibc here.  */
+union semun
+{
+  int val;			/* value for SETVAL */
+  struct semid_ds *buf;		/* buffer for IPC_STAT & IPC_SET */
+  unsigned short int *array;	/* array for GETALL & SETALL */
+  struct seminfo *__buf;	/* buffer for IPC_INFO */
+};
+
+int __semctl (int semid, int semnum, int cmd, ...);
+
+int
+__semctl (int semid, int semnum, int cmd, ...)
+{
+  union semun arg;
+  va_list ap;
+
+  va_start (ap, cmd);
+
+  /* Get the argument.  */
+  arg = va_arg (ap, union semun);
+
+  va_end (ap);
+
+  return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
+			 arg.array);
+}
+
+#include <shlib-compat.h>
+versioned_symbol (libc, __semctl, semctl, GLIBC_2_0);
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
new file mode 100644
index 0000000..17db764
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
@@ -0,0 +1,7 @@ 
+DEFAULT			GLIBC_2.21
+
+%ifdef HAVE_AARCH64_BE
+ld=ld-linux-aarch64_be_ilp32.so.1
+%else
+ld=ld-linux-aarch64_ilp32.so.1
+%endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c
new file mode 100644
index 0000000..ea0fa94
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c
@@ -0,0 +1,32 @@ 
+/* Copyright (C) 2007-2016 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 <errno.h>
+#include <sys/shm.h>
+#include <ipc_priv.h>
+#include <sysdep.h>
+
+int __shmctl (int shmid, int cmd, struct shmid_ds *buf);
+
+int
+__shmctl (int shmid, int cmd, struct shmid_ds *buf)
+{
+  return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf);
+}
+
+#include <shlib-compat.h>
+versioned_symbol (libc, __shmctl, shmctl, GLIBC_2_0);
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list b/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
new file mode 100644
index 0000000..e69de29
diff --git a/sysdeps/unix/sysv/linux/aarch64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/ioctl.S
deleted file mode 100644
index eddd613..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/ioctl.S
+++ /dev/null
@@ -1,31 +0,0 @@ 
-/* Copyright (C) 2012-2016 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>
-
-	.text
-ENTRY(__ioctl)
-	mov	x8, #__NR_ioctl
-	sxtw	x0, w0
-	svc	#0x0
-	cmn	x0, #4095
-	b.cs	.Lsyscall_error
-	ret
-PSEUDO_END (__ioctl)
-
-weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/Implies b/sysdeps/unix/sysv/linux/aarch64/lp64/Implies
new file mode 100644
index 0000000..6418211
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/lp64/Implies
@@ -0,0 +1,4 @@ 
+aarch64/nptl
+unix/sysv/linux/aarch64
+unix/sysv/linux/generic
+unix/sysv/linux/wordsize-64
diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
new file mode 100644
index 0000000..eddd613
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
@@ -0,0 +1,31 @@ 
+/* Copyright (C) 2012-2016 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>
+
+	.text
+ENTRY(__ioctl)
+	mov	x8, #__NR_ioctl
+	sxtw	x0, w0
+	svc	#0x0
+	cmn	x0, #4095
+	b.cs	.Lsyscall_error
+	ret
+PSEUDO_END (__ioctl)
+
+weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c b/sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c
new file mode 100644
index 0000000..0133381
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c
@@ -0,0 +1,34 @@ 
+/* Copyright (C) 2009-2016 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 <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sysdep.h>
+#include <unistd.h>
+
+__ptr_t
+__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+{
+  return (__ptr_t) INLINE_SYSCALL (mmap, 6, addr, len, prot, flags, fd, offset);
+}
+
+weak_alias (__mmap, mmap)
+weak_alias (__mmap, mmap64)
+weak_alias (__mmap, __mmap64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
new file mode 100644
index 0000000..e1768a7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
@@ -0,0 +1,7 @@ 
+DEFAULT			GLIBC_2.17
+
+%ifdef HAVE_AARCH64_BE
+ld=ld-linux-aarch64_be.so.1
+%else
+ld=ld-linux-aarch64.so.1
+%endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/mmap.c b/sysdeps/unix/sysv/linux/aarch64/mmap.c
deleted file mode 100644
index 0133381..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/mmap.c
+++ /dev/null
@@ -1,34 +0,0 @@ 
-/* Copyright (C) 2009-2016 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 <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <sys/syscall.h>
-#include <sysdep.h>
-#include <unistd.h>
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-  return (__ptr_t) INLINE_SYSCALL (mmap, 6, addr, len, prot, flags, fd, offset);
-}
-
-weak_alias (__mmap, mmap)
-weak_alias (__mmap, mmap64)
-weak_alias (__mmap, __mmap64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/shlib-versions
deleted file mode 100644
index e1768a7..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/shlib-versions
+++ /dev/null
@@ -1,7 +0,0 @@ 
-DEFAULT			GLIBC_2.17
-
-%ifdef HAVE_AARCH64_BE
-ld=ld-linux-aarch64_be.so.1
-%else
-ld=ld-linux-aarch64.so.1
-%endif