diff mbox

[16/23,AARCH64] Make lp64 and ilp32 directories.

Message ID 1467131978-669-17-git-send-email-ynorov@caviumnetworks.com
State New
Headers show

Commit Message

Yury Norov June 28, 2016, 4:39 p.m. UTC
From: Andrew Pinski <apinski@cavium.com>

The patch makes the ilp32 and lp64 have their own directory under aarch64.
ILP32 uses most of the same system calls as AARCH32 but has a 64bit off_t,
ino_t etc and 32-bit time_t.

We need make the functions that handle this set of types.

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   | 86 ++++++++++++++++++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies      |  4 +
 .../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c  |  7 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c |  6 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   | 77 +++++++++++++++++++
 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/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 --
 26 files changed, 401 insertions(+), 81 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/bits/typesizes.h
 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/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

Comments

Joseph Myers June 28, 2016, 5:10 p.m. UTC | #1
<https://sourceware.org/ml/libc-alpha/2016-06/msg00789.html> and 
<https://sourceware.org/ml/libc-alpha/2014-10/msg00640.html> still apply.

It's clear this won't be ready to go in within the next two days, so use 
GLIBC_2.25 as symbol version, and be prepared to change it to GLIBC_2.26 
or later if it doesn't get in by the end of the year.
Andreas Schwab June 29, 2016, 8:43 a.m. UTC | #2
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..1183f49
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
> @@ -0,0 +1,77 @@
> +/* 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;
> +}

../sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c: In function 'conv':
../sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c:49:36: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
       struct kernel_dirent64 *nk = (char *) k + k->d_reclen;
                                    ^
../sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c:58:9: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
       u = (char *) u + u->d_reclen;
         ^

Andreas.
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
new file mode 100644
index 0000000..39c0c81
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
@@ -0,0 +1,86 @@ 
+/* bits/typesizes.h -- underlying types for *_t.  Linux/AARCh64 version.
+   Copyright (C) 2011-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/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_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
+#define __OFF_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SQUAD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__UQUAD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_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
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__S32_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+/* ssize_t is always singed long in both ABIs. */
+#define __SSIZE_T_TYPE		__SLONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE         __ULONGWORD_TYPE
+
+/* 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
+
+/* Same for ino_t and ino64_t.  */
+# 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
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
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..b679bfa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
@@ -0,0 +1,7 @@ 
+/* 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..1183f49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
@@ -0,0 +1,77 @@ 
+/* 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)
+{
+
+  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/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