linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC2 PATCH 00/23] ARM64: support ILP32
@ 2016-06-28 16:39 Yury Norov
  2016-06-28 16:39 ` [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32 Yury Norov
                   ` (27 more replies)
  0 siblings, 28 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Yury Norov

This series enables aarch64 port with ilp32 mode.

ABI details:
 - types are taken from AARCH32, next types turned to 64-bit,
   as modern requirement for new APIs tells:
	ino_t      is  u64 type
	off_t      is  s64 type
	blkcnt_t   is  s64 type
	fsblkcnt_t is  u64 type
	fsfilcnt_t is  u64 type
 - 64-bit arguments are passed in syscall as register pair,
   as kernel internally clears top halves for all input regs;
 - standard syscall table is used;
 - 32-bit time_t is used. AARCH64/ILP32 is waiting for general
   fix of Y2038 problem just like other 32-bit arches;
 - stat{64}, statfs{64} structures are of the identical layout
   with LP64. Corresponding syscalls are taken from 64-bit code
 - struct utmp, utmpx layouts are the same.

v1: https://sourceware.org/ml/libc-alpha/2016-06/msg00730.html
v2:
 - rebased on master;
 - dropped unneeded/unrelated patches;
 - pread family platform implementation removed;
 - addressed v1 comments (I'm really sorry if I missed something,
   there are a lot of them, and I am really thankfull for detailed review);

Tested with LTP. Regressions are like this:
abort01                        FAIL       2
kill11                         FAIL       2
mmap16                         FAIL       6
open12                         FAIL       2
rename11                       FAIL       2
rmdir02                        FAIL       2
umount2_01                     FAIL       2
umount2_02                     FAIL       2
umount2_03                     FAIL       2
utime06                        FAIL       2

It's better than v1, and there are ~5 additional regressions comparing to
aarch64, all are related to filesystem.

Andrew Pinski (17):
  [AARCH64] define word size for lp64 and ilp32
  [AARCH64] Add header guards to sysdep.h headers.
  Add dynamic ILP32 AARCH64 relocations to elf.h
  [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in
    LDST_PCREL and LDST_GLOBAL.
  [AARCH64] Use PTR_REG in crti.S.
  [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
  [AARCH64] Use PTR_* macros in dl-trampoline.S
  [AARCH64] Use PTR_* in start.S
  [AARCH64] Use PTR_REG in getcontext.S.
  [AARCH64] Detect ILP32 in configure scripts.
  [AARCH64] Add ILP32 support to elf_machine_load_address.
  [AARCH64] Add ILP32 to makefiles
  [AARCH64] Add support to ldconfig for ILP32 and libilp32
  [AARCH64] Add ILP32 ld.so to the known interpreter names.
  [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
  [AARCH64] Make lp64 and ilp32 directories.
  [AARCH64] Fix ILP32 warning

Yury Norov (6):
  [AARCH64] ILP32: introduce syscalls that pass off_t
  [AARCH64] ILP32: support stat syscall family
  [AARCH64] delouse input arguments in system functions
  [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
  off_t: fix register pair calculation for 64-bit case
  [AARCH64] Take utmp{,x}.h from s390 port

 elf/cache.c                                        |   3 +
 sysdeps/aarch64/Implies                            |   6 -
 sysdeps/aarch64/__longjmp.S                        |   6 +-
 sysdeps/aarch64/bits/wordsize.h                    |  25 +++
 sysdeps/aarch64/configure                          |  15 +-
 sysdeps/aarch64/configure.ac                       |  11 +-
 sysdeps/aarch64/crti.S                             |   3 +-
 sysdeps/aarch64/dl-irel.h                          |   3 +-
 sysdeps/aarch64/dl-machine.h                       | 199 ++++++++++++---------
 sysdeps/aarch64/dl-tlsdesc.S                       |  56 +++---
 sysdeps/aarch64/dl-trampoline.S                    |  18 +-
 sysdeps/aarch64/ilp32/Implies                      |   6 +
 sysdeps/aarch64/jmpbuf-unwind.h                    |   2 +-
 sysdeps/aarch64/lp64/Implies                       |   7 +
 sysdeps/aarch64/memcmp.S                           |   3 +
 sysdeps/aarch64/memcpy.S                           |   8 +
 sysdeps/aarch64/memset.S                           |   3 +
 sysdeps/aarch64/nptl/bits/semaphore.h              |   4 +
 sysdeps/aarch64/preconfigure                       |  11 +-
 sysdeps/aarch64/setjmp.S                           |   5 +-
 sysdeps/aarch64/start.S                            |  20 ++-
 sysdeps/aarch64/strchr.S                           |   1 +
 sysdeps/aarch64/strchrnul.S                        |   1 +
 sysdeps/aarch64/strcmp.S                           |   2 +
 sysdeps/aarch64/strcpy.S                           |   2 +
 sysdeps/aarch64/strlen.S                           |   2 +
 sysdeps/aarch64/strncmp.S                          |   3 +
 sysdeps/aarch64/strnlen.S                          |   3 +
 sysdeps/aarch64/strrchr.S                          |   1 +
 sysdeps/aarch64/sysdep.h                           |  39 +++-
 sysdeps/generic/ldconfig.h                         |   1 +
 sysdeps/generic/stdint.h                           |   9 +-
 sysdeps/unix/sysv/linux/aarch64/Implies            |   2 -
 sysdeps/unix/sysv/linux/aarch64/Makefile           |  16 +-
 sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h       |   6 +-
 sysdeps/unix/sysv/linux/aarch64/bits/stat.h        | 195 ++++++++++++++++++++
 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h      |  64 +++++++
 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   |  86 +++++++++
 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h        |   1 +
 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h       |   1 +
 sysdeps/unix/sysv/linux/aarch64/clone.S            |   7 +
 sysdeps/unix/sysv/linux/aarch64/configure          |  24 ++-
 sysdeps/unix/sysv/linux/aarch64/configure.ac       |  11 +-
 sysdeps/unix/sysv/linux/aarch64/dl-cache.h         |  13 +-
 sysdeps/unix/sysv/linux/aarch64/getcontext.S       |   3 +-
 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/fstatfs.c    |  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |   1 +
 .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c    |   4 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c     |  51 ++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  44 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   |  77 ++++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |   1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c      |  36 ++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c     |  47 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c   |  47 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c       |   1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c     |   1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c     |  32 ++++
 .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |   1 +
 .../sysv/linux/aarch64/ilp32/posix_fadvise64.c     |   2 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |   1 +
 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 ++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c     |  30 ++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
 .../unix/sysv/linux/aarch64/ilp32/syscalls.list    |   0
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |   1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |   4 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c      |  47 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c    |  47 +++++
 sysdeps/unix/sysv/linux/aarch64/ioctl.S            |  31 ----
 sysdeps/unix/sysv/linux/aarch64/kernel-features.h  |  27 +++
 sysdeps/unix/sysv/linux/aarch64/ldconfig.h         |   2 +
 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed    |   1 +
 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/setcontext.S       |   1 +
 sysdeps/unix/sysv/linux/aarch64/shlib-versions     |   7 -
 sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h   |   2 +-
 sysdeps/unix/sysv/linux/aarch64/swapcontext.S      |   1 +
 sysdeps/unix/sysv/linux/aarch64/sysdep.h           |   8 +-
 sysdeps/unix/sysv/linux/arm/readelflib.c           |   4 +-
 sysdeps/unix/sysv/linux/fallocate.c                |   4 +
 sysdeps/unix/sysv/linux/fallocate64.c              |   4 +
 sysdeps/unix/sysv/linux/generic/brk.c              |   2 +-
 sysdeps/unix/sysv/linux/posix_fadvise.c            |   4 +
 sysdeps/unix/sysv/linux/posix_fadvise64.c          |   4 +
 sysdeps/unix/sysv/linux/posix_fallocate.c          |   4 +
 sysdeps/unix/sysv/linux/posix_fallocate64.c        |   4 +
 100 files changed, 1649 insertions(+), 250 deletions(-)
 delete mode 100644 sysdeps/aarch64/Implies
 create mode 100644 sysdeps/aarch64/bits/wordsize.h
 mode change 100644 => 100755 sysdeps/aarch64/configure
 create mode 100644 sysdeps/aarch64/ilp32/Implies
 create mode 100644 sysdeps/aarch64/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h
 mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
 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/fstatfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.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/lseek.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.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/posix_fadvise.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.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/statfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel-features.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
 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

^ permalink raw reply	[flat|nested] 59+ messages in thread

* [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:00   ` Joseph Myers
  2016-06-28 16:39 ` [PATCH 02/23] [AARCH64] Add header guards to sysdep.h headers Yury Norov
                   ` (26 subsequent siblings)
  27 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

Additionally introduce and/or define MIN/MAX macro for size
and ptrdiff types.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/bits/wordsize.h | 25 +++++++++++++++++++++++++
 sysdeps/generic/stdint.h        |  9 +++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/aarch64/bits/wordsize.h

diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
new file mode 100644
index 0000000..569307a
--- /dev/null
+++ b/sysdeps/aarch64/bits/wordsize.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __LP64__
+# define __WORDSIZE			64
+#else
+# define __WORDSIZE			32
+# define __WORDSIZE32_SIZE_ULONG	1
+# define __WORDSIZE32_PTRDIFF_LONG	1
+#endif
+
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 4427627..cedbe43 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -248,8 +248,13 @@ typedef unsigned long long int	uintmax_t;
 #  define PTRDIFF_MIN		(-9223372036854775807L-1)
 #  define PTRDIFF_MAX		(9223372036854775807L)
 # else
-#  define PTRDIFF_MIN		(-2147483647-1)
-#  define PTRDIFF_MAX		(2147483647)
+#  if __WORDSIZE32_PTRDIFF_LONG
+#    define PTRDIFF_MIN		(-2147483647L-1)
+#    define PTRDIFF_MAX		(2147483647L)
+#  else
+#    define PTRDIFF_MIN		(-2147483647-1)
+#    define PTRDIFF_MAX		(2147483647)
+#  endif
 # endif
 
 /* Limits of `sig_atomic_t'.  */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 02/23] [AARCH64] Add header guards to sysdep.h headers.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
  2016-06-28 16:39 ` [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32 Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 03/23] Add dynamic ILP32 AARCH64 relocations to elf.h Yury Norov
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

sysdeps/aarch64/sysdep.h: Add header guards.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/sysdep.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index 6b728ec..594ab0b 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _AARCH64_SYSDEP_H
+#define _AARCH64_SYSDEP_H
+
 #include <sysdeps/generic/sysdep.h>
 
 #ifdef	__ASSEMBLER__
@@ -96,3 +99,5 @@
 #define mcount		_mcount
 
 #endif	/* __ASSEMBLER__ */
+
+#endif  /* _AARCH64_SYSDEP_H */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 03/23] Add dynamic ILP32 AARCH64 relocations to elf.h
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
  2016-06-28 16:39 ` [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32 Yury Norov
  2016-06-28 16:39 ` [PATCH 02/23] [AARCH64] Add header guards to sysdep.h headers Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:03   ` Joseph Myers
  2016-06-28 16:39 ` [PATCH 04/23] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Yury Norov
                   ` (24 subsequent siblings)
  27 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

elf/elf.h (R_AARCH64_P32_ABS32, R_AARCH64_P32_COPY,
R_AARCH64_P32_GLOB_DAT, R_AARCH64_P32_JUMP_SLOT,
R_AARCH64_P32_RELATIVE, R_AARCH64_P32_TLS_DTPMOD,
R_AARCH64_P32_TLS_DTPREL, R_AARCH64_P32_TLS_TPREL,
R_AARCH64_P32_TLSDESC, R_AARCH64_P32_IRELATIVE): Define.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/dl-irel.h    |  3 ++-
 sysdeps/aarch64/dl-machine.h | 53 +++++++++++++++++++++++---------------------
 sysdeps/aarch64/sysdep.h     |  6 +++++
 3 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/sysdeps/aarch64/dl-irel.h b/sysdeps/aarch64/dl-irel.h
index 63a8e50..460454f 100644
--- a/sysdeps/aarch64/dl-irel.h
+++ b/sysdeps/aarch64/dl-irel.h
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <ldsodefs.h>
+#include <sysdep.h>
 
 #define ELF_MACHINE_IRELA	1
 
@@ -40,7 +41,7 @@ elf_irela (const ElfW(Rela) *reloc)
   ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
   const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
 
-  if (__glibc_likely (r_type == R_AARCH64_IRELATIVE))
+  if (__glibc_likely (r_type == AARCH64_R(IRELATIVE)))
     {
       ElfW(Addr) value = elf_ifunc_invoke (reloc->r_addend);
       *reloc_addr = value;
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 282805e..a16cb11 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -21,6 +21,7 @@
 
 #define ELF_MACHINE_NAME "aarch64"
 
+#include <sysdep.h>
 #include <tls.h>
 #include <dl-tlsdesc.h>
 #include <dl-irel.h>
@@ -190,15 +191,15 @@ _dl_start_user:							\n\
 ");
 
 #define elf_machine_type_class(type)					\
-  ((((type) == R_AARCH64_JUMP_SLOT ||					\
-     (type) == R_AARCH64_TLS_DTPMOD ||					\
-     (type) == R_AARCH64_TLS_DTPREL ||					\
-     (type) == R_AARCH64_TLS_TPREL ||					\
-     (type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT)		\
-   | (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY)		\
-   | (((type) == R_AARCH64_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA))
+  ((((type) == AARCH64_R(JUMP_SLOT) ||					\
+     (type) == AARCH64_R(TLS_DTPMOD) ||					\
+     (type) == AARCH64_R(TLS_DTPREL) ||					\
+     (type) == AARCH64_R(TLS_TPREL) ||					\
+     (type) == AARCH64_R(TLSDESC)) * ELF_RTYPE_CLASS_PLT)		\
+   | (((type) == AARCH64_R(COPY)) * ELF_RTYPE_CLASS_COPY)		\
+   | (((type) == AARCH64_R(GLOB_DAT)) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA))
 
-#define ELF_MACHINE_JMP_SLOT	R_AARCH64_JUMP_SLOT
+#define ELF_MACHINE_JMP_SLOT	AARCH64_R(JUMP_SLOT)
 
 /* AArch64 uses RELA not REL */
 #define ELF_MACHINE_NO_REL 1
@@ -237,9 +238,9 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 		  void *const reloc_addr_arg, int skip_ifunc)
 {
   ElfW(Addr) *const reloc_addr = reloc_addr_arg;
-  const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
+  const unsigned int r_type = ELFW(R_TYPE) (reloc->r_info);
 
-  if (__builtin_expect (r_type == R_AARCH64_RELATIVE, 0))
+  if (__builtin_expect (r_type == AARCH64_R(RELATIVE), 0))
       *reloc_addr = map->l_addr + reloc->r_addend;
   else if (__builtin_expect (r_type == R_AARCH64_NONE, 0))
       return;
@@ -257,7 +258,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 
       switch (r_type)
 	{
-	case R_AARCH64_COPY:
+	case AARCH64_R(COPY):
 	  if (sym == NULL)
 	      break;
 
@@ -275,15 +276,17 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 		  MIN (sym->st_size, refsym->st_size));
 	  break;
 
-	case R_AARCH64_RELATIVE:
-	case R_AARCH64_GLOB_DAT:
-	case R_AARCH64_JUMP_SLOT:
-	case R_AARCH64_ABS32:
-	case R_AARCH64_ABS64:
+	case AARCH64_R(RELATIVE):
+	case AARCH64_R(GLOB_DAT):
+	case AARCH64_R(JUMP_SLOT):
+	case AARCH64_R(ABS32):
+#ifdef __LP64__
+	case AARCH64_R(ABS64):
+#endif
 	  *reloc_addr = value + reloc->r_addend;
 	  break;
 
-	case R_AARCH64_TLSDESC:
+	case AARCH64_R(TLSDESC):
 	  {
 	    struct tlsdesc volatile *td =
 	      (struct tlsdesc volatile *)reloc_addr;
@@ -318,7 +321,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 	    break;
 	  }
 
-	case R_AARCH64_TLS_DTPMOD:
+	case AARCH64_R(TLS_DTPMOD):
 #ifdef RTLD_BOOTSTRAP
 	  *reloc_addr = 1;
 #else
@@ -329,12 +332,12 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 #endif
 	  break;
 
-	case R_AARCH64_TLS_DTPREL:
+	case AARCH64_R(TLS_DTPREL):
 	  if (sym)
 	    *reloc_addr = sym->st_value + reloc->r_addend;
 	  break;
 
-	case R_AARCH64_TLS_TPREL:
+	case AARCH64_R(TLS_TPREL):
 	  if (sym)
 	    {
 	      CHECK_STATIC_TLS (map, sym_map);
@@ -343,7 +346,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 	    }
 	  break;
 
-	case R_AARCH64_IRELATIVE:
+	case AARCH64_R(IRELATIVE):
 	  value = map->l_addr + reloc->r_addend;
 	  value = elf_ifunc_invoke (value);
 	  *reloc_addr = value;
@@ -374,16 +377,16 @@ elf_machine_lazy_rel (struct link_map *map,
 		      int skip_ifunc)
 {
   ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
-  const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
+  const unsigned int r_type = ELFW(R_TYPE) (reloc->r_info);
   /* Check for unexpected PLT reloc type.  */
-  if (__builtin_expect (r_type == R_AARCH64_JUMP_SLOT, 1))
+  if (__builtin_expect (r_type == AARCH64_R(JUMP_SLOT), 1))
     {
       if (__builtin_expect (map->l_mach.plt, 0) == 0)
 	*reloc_addr += l_addr;
       else
 	*reloc_addr = map->l_mach.plt;
     }
-  else if (__builtin_expect (r_type == R_AARCH64_TLSDESC, 1))
+  else if (__builtin_expect (r_type == AARCH64_R(TLSDESC), 1))
     {
       struct tlsdesc volatile *td =
 	(struct tlsdesc volatile *)reloc_addr;
@@ -392,7 +395,7 @@ elf_machine_lazy_rel (struct link_map *map,
       td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
 			  + map->l_addr);
     }
-  else if (__glibc_unlikely (r_type == R_AARCH64_IRELATIVE))
+  else if (__glibc_unlikely (r_type == AARCH64_R(IRELATIVE)))
     {
       ElfW(Addr) value = map->l_addr + reloc->r_addend;
       if (__glibc_likely (!skip_ifunc))
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index 594ab0b..05d6f8e 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -21,6 +21,12 @@
 
 #include <sysdeps/generic/sysdep.h>
 
+#ifdef __LP64__
+# define AARCH64_R(NAME)	R_AARCH64_ ## NAME
+#else
+# define AARCH64_R(NAME)	R_AARCH64_P32_ ## NAME
+#endif
+
 #ifdef	__ASSEMBLER__
 
 /* Syntactic details of assembler.  */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 04/23] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in LDST_PCREL and LDST_GLOBAL.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (2 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 03/23] Add dynamic ILP32 AARCH64 relocations to elf.h Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 05/23] [AARCH64] Use PTR_REG in crti.S Yury Norov
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

This patch adds a few extra macros which are useful for ILP32 and updates
PTR_MANGLE and PTR_DEMANGLE to use the some of the new macros.

* sysdeps/aarch64/sysdep.h (PTR_REG): New macro.
(PTR_LOG_SIZE): New macro.
(PTR_SIZE): New macro.
(LDST_PCREL): Use arguments as register numbers rather register names.
Use PTR_REG for the register when loading.
* sysdeps/unix/sysv/linux/aarch64/sysdep.h (PTR_MANGLE): Add a comment
about that the arguments are register numbers rather register names.
(PTR_DEMANGLE): Likewise.
* sysdeps/aarch64/__longjmp.S (__longjmp): Update calls to PTR_DEMANGLE.
* sysdeps/aarch64/setjmp.S (__sigsetjmp): Update calls to PTR_MANGLE.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/__longjmp.S              |  4 ++--
 sysdeps/aarch64/setjmp.S                 |  4 ++--
 sysdeps/aarch64/sysdep.h                 | 28 ++++++++++++++++++----------
 sysdeps/unix/sysv/linux/aarch64/sysdep.h |  8 ++++++--
 4 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
index 65116be..58332be 100644
--- a/sysdeps/aarch64/__longjmp.S
+++ b/sysdeps/aarch64/__longjmp.S
@@ -53,7 +53,7 @@ ENTRY (__longjmp)
 	ldp	x27, x28, [x0, #JB_X27<<3]
 #ifdef PTR_DEMANGLE
 	ldp	x29,  x4, [x0, #JB_X29<<3]
-	PTR_DEMANGLE (x30, x4, x3, x2)
+	PTR_DEMANGLE (30, 4, 3, 2)
 #else
 	ldp	x29, x30, [x0, #JB_X29<<3]
 #endif
@@ -98,7 +98,7 @@ ENTRY (__longjmp)
 	cfi_same_value(d15)
 #ifdef PTR_DEMANGLE
 	ldr	x4, [x0, #JB_SP<<3]
-	PTR_DEMANGLE (x5, x4, x3, x2)
+	PTR_DEMANGLE (5, 4, 3, 2)
 #else
 	ldr	x5, [x0, #JB_SP<<3]
 #endif
diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
index 22f4368..da83f19 100644
--- a/sysdeps/aarch64/setjmp.S
+++ b/sysdeps/aarch64/setjmp.S
@@ -42,7 +42,7 @@ ENTRY (__sigsetjmp)
 	stp	x27, x28, [x0, #JB_X27<<3]
 
 #ifdef PTR_MANGLE
-	PTR_MANGLE (x4, x30, x3, x2)
+	PTR_MANGLE (4, 30, 3, 2)
 	stp	x29,  x4, [x0, #JB_X29<<3]
 #else
 	stp	x29, x30, [x0, #JB_X29<<3]
@@ -57,7 +57,7 @@ ENTRY (__sigsetjmp)
 	stp	d14, d15, [x0, #JB_D14<<3]
 #ifdef PTR_MANGLE
 	mov	x4, sp
-	PTR_MANGLE (x5, x4, x3, x2)
+	PTR_MANGLE (5, 4, 3, 2)
 	str	x5, [x0, #JB_SP<<3]
 #else
 	mov	x2,  sp
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index 05d6f8e..4ce0945 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -23,10 +23,16 @@
 
 #ifdef __LP64__
 # define AARCH64_R(NAME)	R_AARCH64_ ## NAME
+# define PTR_REG(n)		x##n
+# define PTR_LOG_SIZE		3
 #else
 # define AARCH64_R(NAME)	R_AARCH64_P32_ ## NAME
+# define PTR_REG(n)		w##n
+# define PTR_LOG_SIZE		2
 #endif
 
+#define PTR_SIZE	(1<<PTR_LOG_SIZE)
+
 #ifdef	__ASSEMBLER__
 
 /* Syntactic details of assembler.  */
@@ -87,16 +93,18 @@
 # define L(name)         .L##name
 #endif
 
-/* Load or store to/from a pc-relative EXPR into/from R, using T.  */
-#define LDST_PCREL(OP, R, T, EXPR)  \
-	adrp	T, EXPR;	    \
-	OP	R, [T, #:lo12:EXPR];\
-
-/* Load or store to/from a got-relative EXPR into/from R, using T.  */
-#define LDST_GLOBAL(OP, R, T, EXPR)     \
-	adrp	T, :got:EXPR;		\
-	ldr	T, [T, #:got_lo12:EXPR];\
-	OP	R, [T];
+/* Load or store to/from a pc-relative EXPR into/from R, using T.
+   Note R and T are register numbers and not register names.  */
+#define LDST_PCREL(OP, R, T, EXPR)			\
+	adrp	x##T, EXPR;				\
+	OP	PTR_REG (R), [x##T, #:lo12:EXPR];	\
+
+/* Load or store to/from a got-relative EXPR into/from R, using T.
+   Note R and T are register numbers and not register names.  */
+#define LDST_GLOBAL(OP, R, T,  EXPR)			\
+	adrp	x##T, :got:EXPR;			\
+	ldr	PTR_REG (T), [x##T, #:got_lo12:EXPR];	\
+	OP	PTR_REG (R), [x##T];
 
 /* Since C identifiers are not normally prefixed with an underscore
    on this system, the asm identifier `syscall_error' intrudes on the
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index a397e50..1ffabc2 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -250,12 +250,14 @@
      (!defined SHARED && (IS_IN (libc) \
 			  || IS_IN (libpthread))))
 # ifdef __ASSEMBLER__
+/* Note, dst, src, guard, and tmp are all register numbers rather than
+   register names so they will work with both ILP32 and LP64. */
 #  define PTR_MANGLE(dst, src, guard, tmp)                                \
   LDST_PCREL (ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local)); \
   PTR_MANGLE2 (dst, src, guard)
 /* Use PTR_MANGLE2 for efficiency if guard is already loaded.  */
 #  define PTR_MANGLE2(dst, src, guard)\
-  eor dst, src, guard
+  eor x##dst, x##src, x##guard
 #  define PTR_DEMANGLE(dst, src, guard, tmp)\
   PTR_MANGLE (dst, src, guard, tmp)
 #  define PTR_DEMANGLE2(dst, src, guard)\
@@ -268,12 +270,14 @@ extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
 # endif
 #else
 # ifdef __ASSEMBLER__
+/* Note, dst, src, guard, and tmp are all register numbers rather than
+   register names so they will work with both ILP32 and LP64. */
 #  define PTR_MANGLE(dst, src, guard, tmp)                             \
   LDST_GLOBAL (ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard));   \
   PTR_MANGLE2 (dst, src, guard)
 /* Use PTR_MANGLE2 for efficiency if guard is already loaded.  */
 #  define PTR_MANGLE2(dst, src, guard)\
-  eor dst, src, guard
+  eor x##dst, x##src, x##guard
 #  define PTR_DEMANGLE(dst, src, guard, tmp)\
   PTR_MANGLE (dst, src, guard, tmp)
 #  define PTR_DEMANGLE2(dst, src, guard)\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 05/23] [AARCH64] Use PTR_REG in crti.S.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (3 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 04/23] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:05   ` Joseph Myers
  2016-06-28 16:39 ` [PATCH 06/23] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Yury Norov
                   ` (22 subsequent siblings)
  27 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

call_weak_fn loads from a pointer, so use PTR_REG so the load
is 32bits for ILP32.

* sysdeps/aarch64/crti.S: Include sysdep.h
(call_weak_fn): Use PTR_REG when loading from
PREINIT_FUNCTION.

AARCH64: Make RTLD_START paramatizable

Make RTLD_START paramatizable for ILP32 and LP64 usage and provides common
code between ILP32.

* sysdeps/aarch64/dl-machine.h (RTLD_START): Rename to ...
(RTLD_START_1): This and add PTR, PTR_SIZE_LOG, and PTR_SP arguments.
(RTLD_START): New macro which uses RTLD_START_1.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/crti.S       |   3 +-
 sysdeps/aarch64/dl-machine.h | 128 ++++++++++++++++++++++---------------------
 2 files changed, 69 insertions(+), 62 deletions(-)

diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S
index 53ccb42..6e149b5 100644
--- a/sysdeps/aarch64/crti.S
+++ b/sysdeps/aarch64/crti.S
@@ -39,6 +39,7 @@
    they can be called as functions.  The symbols _init and _fini are
    magic and cause the linker to emit DT_INIT and DT_FINI.  */
 
+#include <sysdep.h>
 #include <libc-symbols.h>
 
 #ifndef PREINIT_FUNCTION
@@ -60,7 +61,7 @@
 	.type	call_weak_fn, %function
 call_weak_fn:
 	adrp	x0, :got:PREINIT_FUNCTION
-	ldr	x0, [x0, #:got_lo12:PREINIT_FUNCTION]
+	ldr	PTR_REG(0), [x0, #:got_lo12:PREINIT_FUNCTION]
 	cbz	x0, 1f
 	b	PREINIT_FUNCTION
 1:
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index a16cb11..ec41bfe 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -126,68 +126,74 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 /* Initial entry point for the dynamic linker. The C function
    _dl_start is the real entry point, its return value is the user
    program's entry point */
+#ifdef __LP64__
+# define RTLD_START RTLD_START_1 ("x", "3", "sp")
+#else
+# define RTLD_START RTLD_START_1 ("w", "2", "wsp")
+#endif
+
 
-#define RTLD_START asm ("\
-.text								\n\
-.globl _start							\n\
-.type _start, %function						\n\
-.globl _dl_start_user						\n\
-.type _dl_start_user, %function					\n\
-_start:								\n\
-	mov	x0,	sp					\n\
-	bl	_dl_start					\n\
-	// returns user entry point in x0			\n\
-	mov	x21, x0						\n\
-_dl_start_user:							\n\
-	// get the original arg count				\n\
-	ldr	x1, [sp]					\n\
-	// get the argv address					\n\
-	add	x2, sp, #8					\n\
-	// get _dl_skip_args to see if we were			\n\
-	// invoked as an executable				\n\
-	adrp	x4, _dl_skip_args				\n\
-        ldr	w4, [x4, #:lo12:_dl_skip_args]			\n\
-	// do we need to adjust argc/argv			\n\
-        cmp	w4, 0						\n\
-	beq	.L_done_stack_adjust				\n\
-	// subtract _dl_skip_args from original arg count	\n\
-	sub	x1, x1, x4					\n\
-	// store adjusted argc back to stack			\n\
-	str	x1, [sp]					\n\
-	// find the first unskipped argument			\n\
-	mov	x3, x2						\n\
-	add	x4, x2, x4, lsl #3				\n\
-	// shuffle argv down					\n\
-1:	ldr	x5, [x4], #8					\n\
-	str	x5, [x3], #8					\n\
-	cmp	x5, #0						\n\
-	bne	1b						\n\
-	// shuffle envp down					\n\
-1:	ldr	x5, [x4], #8					\n\
-	str	x5, [x3], #8					\n\
-	cmp	x5, #0						\n\
-	bne	1b						\n\
-	// shuffle auxv down					\n\
-1:	ldp	x0, x5, [x4, #16]!				\n\
-	stp	x0, x5, [x3], #16				\n\
-	cmp	x0, #0						\n\
-	bne	1b						\n\
-	// Update _dl_argv					\n\
-	adrp	x3, _dl_argv					\n\
-	str	x2, [x3, #:lo12:_dl_argv]			\n\
-.L_done_stack_adjust:						\n\
-	// compute envp						\n\
-	add	x3, x2, x1, lsl #3				\n\
-	add	x3, x3, #8					\n\
-	adrp	x16, _rtld_local				\n\
-        add	x16, x16, #:lo12:_rtld_local			\n\
-        ldr	x0, [x16]					\n\
-	bl	_dl_init					\n\
-	// load the finalizer function				\n\
-	adrp	x0, _dl_fini					\n\
-	add	x0, x0, #:lo12:_dl_fini				\n\
-	// jump to the user_s entry point			\n\
-	br      x21						\n\
+#define RTLD_START_1(PTR, PTR_SIZE_LOG, PTR_SP) asm ("\
+.text									\n\
+.globl _start								\n\
+.type _start, %function							\n\
+.globl _dl_start_user							\n\
+.type _dl_start_user, %function						\n\
+_start:									\n\
+	mov	" PTR "0, " PTR_SP "					\n\
+	bl	_dl_start						\n\
+	// returns user entry point in x0				\n\
+	mov	x21, x0							\n\
+_dl_start_user:								\n\
+	// get the original arg count					\n\
+	ldr	" PTR "1, [sp]						\n\
+	// get the argv address						\n\
+	add	" PTR "2, " PTR_SP ", #(1<<"  PTR_SIZE_LOG ")		\n\
+	// get _dl_skip_args to see if we were				\n\
+	// invoked as an executable					\n\
+	adrp	x4, _dl_skip_args					\n\
+        ldr	w4, [x4, #:lo12:_dl_skip_args]				\n\
+	// do we need to adjust argc/argv				\n\
+        cmp	w4, 0							\n\
+	beq	.L_done_stack_adjust					\n\
+	// subtract _dl_skip_args from original arg count		\n\
+	sub	" PTR "1, " PTR "1, " PTR "4				\n\
+	// store adjusted argc back to stack				\n\
+	str	" PTR "1, [sp]						\n\
+	// find the first unskipped argument				\n\
+	mov	" PTR "3, " PTR "2					\n\
+	add	" PTR "4, " PTR "2, " PTR "4, lsl #" PTR_SIZE_LOG "	\n\
+	// shuffle argv down						\n\
+1:	ldr	" PTR "5, [x4], #(1<<"  PTR_SIZE_LOG ")			\n\
+	str	" PTR "5, [x3], #(1<<"  PTR_SIZE_LOG ")			\n\
+	cmp	" PTR "5, #0						\n\
+	bne	1b							\n\
+	// shuffle envp down						\n\
+1:	ldr	" PTR "5, [x4], #(1<<"  PTR_SIZE_LOG ")			\n\
+	str	" PTR "5, [x3], #(1<<"  PTR_SIZE_LOG ")			\n\
+	cmp	" PTR "5, #0						\n\
+	bne	1b							\n\
+	// shuffle auxv down						\n\
+1:	ldp	" PTR "0, " PTR "5, [x4, #(2<<"  PTR_SIZE_LOG ")]!	\n\
+	stp	" PTR "0, " PTR "5, [x3], #(2<<"  PTR_SIZE_LOG ")	\n\
+	cmp	" PTR "0, #0						\n\
+	bne	1b							\n\
+	// Update _dl_argv						\n\
+	adrp	x3, _dl_argv						\n\
+	str	" PTR "2, [x3, #:lo12:_dl_argv]				\n\
+.L_done_stack_adjust:							\n\
+	// compute envp							\n\
+	add	" PTR "3, " PTR "2, " PTR "1, lsl #" PTR_SIZE_LOG "	\n\
+	add	" PTR "3, " PTR "3, #(1<<"  PTR_SIZE_LOG ")		\n\
+	adrp	x16, _rtld_local					\n\
+        add	" PTR "16, " PTR "16, #:lo12:_rtld_local		\n\
+        ldr	" PTR "0, [x16]						\n\
+	bl	_dl_init						\n\
+	// load the finalizer function					\n\
+	adrp	x0, _dl_fini						\n\
+	add	" PTR "0, " PTR "0, #:lo12:_dl_fini			\n\
+	// jump to the user_s entry point				\n\
+	br      x21							\n\
 ");
 
 #define elf_machine_type_class(type)					\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 06/23] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (4 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 05/23] [AARCH64] Use PTR_REG in crti.S Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:06   ` Joseph Myers
  2016-06-28 16:39 ` [PATCH 07/23] [AARCH64] Use PTR_* macros in dl-trampoline.S Yury Norov
                   ` (21 subsequent siblings)
  27 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

This converts dl-tlsdesc.S code over to use the new macros which allows for
sharing between ILP32 and LP64 code.

* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
(_dl_tlsdesc_dynamic)		: Use PTR_REG, PTR_SIZE.
(_dl_tlsdesc_resolve_hold)	: Likewise.
(_dl_tlsdesc_resolve_rela)	: Likewise.
(_dl_tlsdesc_return_lazy)	: Likewise.
(_dl_tlsdesc_undefweak)		: Likewise.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/dl-tlsdesc.S | 48 ++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index 05be370..09cd158 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,7 +74,7 @@
 	cfi_startproc
 	.align 2
 _dl_tlsdesc_return:
-	ldr	x0, [x0, #8]
+	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	RET
 	cfi_endproc
 	.size	_dl_tlsdesc_return, .-_dl_tlsdesc_return
@@ -95,9 +95,9 @@ _dl_tlsdesc_return_lazy:
 	   so it reads the same value (this function is the final value of
 	   td->entry) and thus it synchronizes with the release store to
 	   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
-	   from [x0,#8] here happens after the initialization of td->arg.  */
-	ldar	xzr, [x0]
-	ldr	x0, [x0, #8]
+	   from [x0,#PTR_SIZE] here happens after the initialization of td->arg. */
+	ldar	PTR_REG (zr), [x0]
+	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	RET
 	cfi_endproc
 	.size	_dl_tlsdesc_return_lazy, .-_dl_tlsdesc_return_lazy
@@ -125,10 +125,10 @@ _dl_tlsdesc_undefweak:
 	   td->entry) and thus it synchronizes with the release store to
 	   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
 	   from [x0,#8] here happens after the initialization of td->arg.  */
-	ldar	xzr, [x0]
-	ldr	x0, [x0, #8]
+	ldar	PTR_REG (zr), [x0]
+	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	mrs	x1, tpidr_el0
-	sub	x0, x0, x1
+	sub	PTR_REG (0), PTR_REG (0), PTR_REG (1)
 	ldr	x1, [sp], #16
 	cfi_adjust_cfa_offset (-16)
 	RET
@@ -187,22 +187,22 @@ _dl_tlsdesc_dynamic:
 	   so it reads the same value (this function is the final value of
 	   td->entry) and thus it synchronizes with the release store to
 	   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
-	   from [x0,#8] here happens after the initialization of td->arg.  */
-	ldar	xzr, [x0]
-	ldr	x1, [x0,#8]
-	ldr	x0, [x4]
-	ldr	x3, [x1,#16]
-	ldr	x2, [x0]
-	cmp	x3, x2
+	   from [x0,#PTR_SIZE] here happens after the initialization of td->arg.  */
+	ldar	PTR_REG (zr), [x0]
+	ldr	PTR_REG (1), [x0,#PTR_SIZE]
+	ldr	PTR_REG (0), [x4]
+	ldr	PTR_REG (3), [x1,#(PTR_SIZE * 2)]
+	ldr	PTR_REG (2), [x0]
+	cmp	PTR_REG (3), PTR_REG (2)
 	b.hi	2f
-	ldr	x2, [x1]
-	add	x0, x0, x2, lsl #4
-	ldr	x0, [x0]
+	ldr	PTR_REG (2), [x1]
+	add	PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
+	ldr	PTR_REG (0), [x0]
 	cmn	x0, #0x1
 	b.eq	2f
-	ldr	x1, [x1,#8]
-	add	x0, x0, x1
-	sub	x0, x0, x4
+	ldr	PTR_REG (1), [x1,#(PTR_SIZE * 2)]
+	add	PTR_REG (0), PTR_REG (0), PTR_REG (1)
+	sub	PTR_REG (0), PTR_REG (0), PTR_REG (4)
 1:
 	ldp	 x1,  x2, [sp, #32+16*0]
 	ldp	 x3,  x4, [sp, #32+16*1]
@@ -233,7 +233,7 @@ _dl_tlsdesc_dynamic:
 	bl	__tls_get_addr
 
 	mrs	x1, tpidr_el0
-	sub	x0, x0, x1
+	sub	PTR_REG (0), PTR_REG (0), PTR_REG (1)
 
 	RESTORE_Q_REGISTERS
 
@@ -279,13 +279,13 @@ _dl_tlsdesc_resolve_rela:
 
 	SAVE_Q_REGISTERS
 
-	ldr	x1, [x3, #8]
+	ldr	PTR_REG (1), [x3, #PTR_SIZE]
 	bl	_dl_tlsdesc_resolve_rela_fixup
 
 	RESTORE_Q_REGISTERS
 
 	ldr	x0, [sp, #32+16*8]
-	ldr	x1, [x0]
+	ldr	PTR_REG (1), [x0]
 	blr	x1
 
 	ldp	 x1,  x4, [sp, #32+16*0]
@@ -346,7 +346,7 @@ _dl_tlsdesc_resolve_hold:
 	RESTORE_Q_REGISTERS
 
 	ldr	x0, [sp, #32+16*9]
-	ldr	x1, [x0]
+	ldr	PTR_REG (1), [x0]
 	blr	x1
 
 	ldp	 x1,  x2, [sp, #32+16*0]
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 07/23] [AARCH64] Use PTR_* macros in dl-trampoline.S
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (5 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 06/23] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 08/23] [AARCH64] Use PTR_* in start.S Yury Norov
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

Use the PTR_* macros in dl-trampoline.S so it can be used for
both ILP32 and LP64.  Also add a comment about what was an magic number
(the size of the rela relocation entries).

* sysdeps/aarch64/dl-trampoline.S (ip0l): New define.
(RELA_SIZE): New define.
(_dl_runtime_resolve): Use PTR_REG, PTR_SIZE.
(_dl_runtime_profile): Likewise.  Use RELA_SIZE and ip0l.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/dl-trampoline.S | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S
index 947a515..63ef6f7 100644
--- a/sysdeps/aarch64/dl-trampoline.S
+++ b/sysdeps/aarch64/dl-trampoline.S
@@ -22,9 +22,13 @@
 #include "dl-link.h"
 
 #define ip0 x16
+#define ip0l PTR_REG (16)
 #define ip1 x17
 #define lr  x30
 
+/* RELA relocatons are 3 pointers */
+#define RELA_SIZE (PTR_SIZE * 3)
+
 	.text
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, #function
@@ -79,7 +83,7 @@ _dl_runtime_resolve:
 	cfi_rel_offset (q1, 80+7*16)
 
 	/* Get pointer to linker struct.  */
-	ldr	x0, [ip0, #-8]
+	ldr	PTR_REG (0), [ip0, #-PTR_SIZE]
 
 	/* Prepare to call _dl_fixup().  */
 	ldr	x1, [sp, 80+8*16]	/* Recover &PLTGOT[n] */
@@ -87,7 +91,7 @@ _dl_runtime_resolve:
 	sub     x1, x1, ip0
 	add     x1, x1, x1, lsl #1
 	lsl     x1, x1, #3
-	sub     x1, x1, #192
+	sub     x1, x1, #(RELA_SIZE<<3)
 	lsr     x1, x1, #3
 
 	/* Call fixup routine.  */
@@ -191,7 +195,7 @@ _dl_runtime_profile:
 	stp	x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_SP]
 
 	/* Get pointer to linker struct.  */
-	ldr	x0, [ip0, #-8]
+	ldr	PTR_REG (0), [ip0, #-PTR_SIZE]
 
 	/* Prepare to call _dl_profile_fixup().  */
 	ldr	x1, [x29, OFFSET_PLTGOTN]	/* Recover &PLTGOT[n] */
@@ -199,7 +203,7 @@ _dl_runtime_profile:
 	sub     x1, x1, ip0
 	add     x1, x1, x1, lsl #1
 	lsl     x1, x1, #3
-	sub     x1, x1, #192
+	sub     x1, x1, #(RELA_SIZE<<3)
 	lsr     x1, x1, #3
 
 	stp	x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
@@ -210,8 +214,8 @@ _dl_runtime_profile:
 	add	x4, x29, #OFFSET_FS		/* address of framesize */
 	bl	_dl_profile_fixup
 
-	ldr	ip0, [x29, #OFFSET_FS]		/* framesize == 0 */
-	cmp	ip0, #0
+	ldr	ip0l, [x29, #OFFSET_FS]		/* framesize == 0 */
+	cmp	ip0l, #0
 	bge	1f
 	cfi_remember_state
 
@@ -243,7 +247,7 @@ _dl_runtime_profile:
 1:
 	/* The new frame size is in ip0.  */
 
-	sub	x1, x29, ip0
+	sub	PTR_REG (1), PTR_REG (29), ip0l
 	and	sp, x1, #0xfffffffffffffff0
 
 	str	x0, [x29, #OFFSET_T1]
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 08/23] [AARCH64] Use PTR_* in start.S
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (6 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 07/23] [AARCH64] Use PTR_* macros in dl-trampoline.S Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 09/23] [AARCH64] Use PTR_REG in getcontext.S Yury Norov
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

To support ILP32 without much sources changes, this changes
sysdeps/aarch64/start.S to use the PTR_* macros which was defined
earlier.

* sysdeps/aarch64/start.S: Include sysdep.h
(_start): Use PTR_REG, PTR_SIZE macros.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/start.S | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
index efe2474..9198c57 100644
--- a/sysdeps/aarch64/start.S
+++ b/sysdeps/aarch64/start.S
@@ -16,6 +16,8 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <sysdep.h>
+
 /* This is the canonical entry point, usually the first thing in the text
    segment.
 
@@ -25,7 +27,7 @@
 
    At this entry point, most registers' values are unspecified, except:
 
-   x0		Contains a function pointer to be registered with `atexit'.
+   x0/w0	Contains a function pointer to be registered with `atexit'.
 		This is how the dynamic linker arranges to have DT_FINI
 		functions called for shared libraries that have been loaded
 		before this code runs.
@@ -52,26 +54,26 @@ _start:
 	mov	x5, x0
 
 	/* Load argc and a pointer to argv */
-	ldr	x1, [sp, #0]
-	add	x2, sp, #8
+	ldr	PTR_REG (1), [sp, #0]
+	add	x2, sp, #PTR_SIZE
 
 	/* Setup stack limit in argument register */
 	mov	x6, sp
 
 #ifdef SHARED
         adrp    x0, :got:main
-	ldr     x0, [x0, #:got_lo12:main]
+	ldr     PTR_REG (0), [x0, #:got_lo12:main]
 
         adrp    x3, :got:__libc_csu_init
-	ldr     x3, [x3, #:got_lo12:__libc_csu_init]
+	ldr     PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
 
         adrp    x4, :got:__libc_csu_fini
-	ldr     x4, [x4, #:got_lo12:__libc_csu_fini]
+	ldr     PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
 #else
 	/* Set up the other arguments in registers */
-	ldr	x0, =main
-	ldr	x3, =__libc_csu_init
-	ldr	x4, =__libc_csu_fini
+	ldr	PTR_REG (0), =main
+	ldr	PTR_REG (3), =__libc_csu_init
+	ldr	PTR_REG (4), =__libc_csu_fini
 #endif
 
 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 09/23] [AARCH64] Use PTR_REG in getcontext.S.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (7 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 08/23] [AARCH64] Use PTR_* in start.S Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts Yury Norov
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

Just like the other patches, this patch allows for getcontext.S to be used
between ILP32 and LP64.

* sysdeps/unix/sysv/linux/aarch64/getcontext.S: Use PTR_REG when
doing an add so wrapping of the pointer is correct for ILP32.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index c2dd5b8..71e526c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -90,7 +90,7 @@ ENTRY(__getcontext)
 
 	/* Grab the signal mask */
 	/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
-	add	x2, x0, #UCONTEXT_SIGMASK
+	add	PTR_REG (2), PTR_REG (0), #UCONTEXT_SIGMASK
 	mov	x0, SIG_BLOCK
 	mov	x1, 0
 	mov	x3, _NSIG8
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (8 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 09/23] [AARCH64] Use PTR_REG in getcontext.S Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:07   ` Joseph Myers
  2016-06-28 16:39 ` [PATCH 11/23] [AARCH64] Add ILP32 support to elf_machine_load_address Yury Norov
                   ` (17 subsequent siblings)
  27 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

This adds detecting of ILP32 to the configure scripts.
Adding to preconfigure detection of ilp32 in preconfigure and then writing out the default-abi in configure.

* sysdeps/aarch64/preconfigure: Detect ILP32 and set aarch64_config_abi
to ilp32 for ilp32 and lp64 for lp64.  Set machine to either
aarch64/ilp32 or aarch64/lp64 depending on the ABI that is selected.
* sysdeps/aarch64/configure.ac: Define HAVE_AARCH64_ILP32 if this is ILP32.
Set the default-abi to either ilp32, lp64, ilp32_be or lp64_be depending
on the ABI.
* sysdeps/aarch64/configure: Regenerate.
* sysdeps/unix/sysv/linux/aarch64/configure.ac: Set arch_minimum_kernel
to 3.19.0 for ILP32.
Set LIBC_SLIBDIR_RTLDDIR to libilp32/lib for ilp32.
* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/configure                    | 15 +++++++++++----
 sysdeps/aarch64/configure.ac                 | 11 +++++++++--
 sysdeps/aarch64/preconfigure                 | 11 ++++++++++-
 sysdeps/unix/sysv/linux/aarch64/configure    | 22 +++++++++++++++++++---
 sysdeps/unix/sysv/linux/aarch64/configure.ac |  9 +++++++--
 5 files changed, 56 insertions(+), 12 deletions(-)
 mode change 100644 => 100755 sysdeps/aarch64/configure
 mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure

diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
old mode 100644
new mode 100755
index 5bd355a..7dd56e8
--- a/sysdeps/aarch64/configure
+++ b/sysdeps/aarch64/configure
@@ -163,12 +163,19 @@ rm -f conftest*
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_be" >&5
 $as_echo "$libc_cv_aarch64_be" >&6; }
+
+if test $aarch64_config_abi = ilp32; then
+  $as_echo "#define HAVE_AARCH64_ILP32 1" >>confdefs.h
+
+fi
+
 if test $libc_cv_aarch64_be = yes; then
   $as_echo "#define HAVE_AARCH64_BE 1" >>confdefs.h
 
-  config_vars="$config_vars
-default-abi = lp64_be"
+  libc_aarch64_be=_be
 else
-  config_vars="$config_vars
-default-abi = lp64"
+  libc_aarch64_be=
 fi
+
+config_vars="$config_vars
+default-abi = ${aarch64_config_abi}${libc_aarch64_be}"
diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
index 7851dd4..9069325 100644
--- a/sysdeps/aarch64/configure.ac
+++ b/sysdeps/aarch64/configure.ac
@@ -14,9 +14,16 @@ AC_CACHE_CHECK([for big endian],
                       yes
                      #endif
   ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
+
+if test $aarch64_config_abi = ilp32; then
+  AC_DEFINE(HAVE_AARCH64_ILP32)
+fi
+
 if test $libc_cv_aarch64_be = yes; then
   AC_DEFINE(HAVE_AARCH64_BE)
-  LIBC_CONFIG_VAR([default-abi], [lp64_be])
+  libc_aarch64_be=_be
 else
-  LIBC_CONFIG_VAR([default-abi], [lp64])
+  libc_aarch64_be=
 fi
+
+LIBC_CONFIG_VAR([default-abi], [${aarch64_config_abi}${libc_aarch64_be}])
diff --git a/sysdeps/aarch64/preconfigure b/sysdeps/aarch64/preconfigure
index d9bd1f8..4bcd8e3 100644
--- a/sysdeps/aarch64/preconfigure
+++ b/sysdeps/aarch64/preconfigure
@@ -1,6 +1,15 @@
 case "$machine" in
 aarch64*)
 	base_machine=aarch64
-	machine=aarch64
+	case "$CC $CFLAGS $CPPFLAGS " in
+		*" -mabi=ilp32 "*) aarch64_config_abi=ilp32 ;;
+		*" -mabi=lp64 "*) aarch64_config_abi=lp64 ;;
+		*) aarch64_config_abi=default ;;
+	esac
+	case $aarch64_config_abi in
+		default) machine=aarch64/lp64 aarch64_config_abi=lp64 ;;
+		ilp32) machine=aarch64/ilp32 ;;
+		lp64) machine=aarch64/lp64 ;;
+	esac
 	;;
 esac
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
old mode 100644
new mode 100755
index f48472c..c6fca86
--- a/sysdeps/unix/sysv/linux/aarch64/configure
+++ b/sysdeps/unix/sysv/linux/aarch64/configure
@@ -1,9 +1,23 @@
 # This file is generated from configure.ac 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" ||
+if test $aarch64_config_abi = ilp32; then
+  arch_minimum_kernel=3.19.0
+  test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+/usr | /usr/)
+  libc_cv_slibdir=/libilp32
+  libc_cv_rtlddir=/lib
+  if test "$libdir" = '${exec_prefix}/lib'; then
+    libdir='${exec_prefix}/libilp32';
+    # Locale data can be shared between 32-bit and 64-bit libraries.
+    libc_cv_complocaledir='${exec_prefix}/lib/locale'
+  fi
+  ;;
+esac
+else
+  arch_minimum_kernel=3.7.0
+  test -n "$libc_cv_slibdir" ||
 case "$prefix" in
 /usr | /usr/)
   libc_cv_slibdir=/lib64
@@ -15,3 +29,5 @@ case "$prefix" in
   fi
   ;;
 esac
+fi
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
index 211fa9c..b37a7eb 100644
--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
+++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
@@ -1,6 +1,11 @@
 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
+if test $aarch64_config_abi = ilp32; then
+  arch_minimum_kernel=10.0.0
+  LIBC_SLIBDIR_RTLDDIR([libilp32], [lib])
+else
+  arch_minimum_kernel=3.7.0
+  LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
+fi
 
-LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 11/23] [AARCH64] Add ILP32 support to elf_machine_load_address.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (9 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 12/23] [AARCH64] Add ILP32 to makefiles Yury Norov
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

This adds ILP32 support to elf_machine_load_address.
Since elf_machine_load_address depends on the static address being
found without relocations, we need to use 16bit relocation which gets
resolved at link time for ILP32.  This is just like how the 32bit
relocation gets resolved at link time for LP64.

* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Add support
for ILP32.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/dl-machine.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index ec41bfe..29d54e2 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -54,19 +54,33 @@ elf_machine_load_address (void)
      by constructing a non GOT reference to the symbol, the dynamic
      address of the symbol we compute using adrp/add to compute the
      symbol's address relative to the PC.
-     This depends on 32bit relocations being resolved at link time
-     and that the static address fits in the 32bits.  */
+     This depends on 32/16bit relocations being resolved at link time
+     and that the static address fits in the 32/16 bits.  */
 
   ElfW(Addr) static_addr;
   ElfW(Addr) dynamic_addr;
 
   asm ("					\n"
 "	adrp	%1, _dl_start;			\n"
+#ifdef __LP64__
 "	add	%1, %1, #:lo12:_dl_start	\n"
+#else
+"	add	%w1, %w1, #:lo12:_dl_start	\n"
+#endif
 "	ldr	%w0, 1f				\n"
 "	b	2f				\n"
 "1:						\n"
+#ifdef __LP64__
 "	.word	_dl_start			\n"
+#else
+# ifdef __AARCH64EB__
+"	.short  0                               \n"
+# endif
+"	.short  _dl_start                       \n"
+# ifndef __AARCH64EB__
+"	.short  0                               \n"
+# endif
+#endif
 "2:						\n"
     : "=r" (static_addr),  "=r" (dynamic_addr));
   return dynamic_addr - static_addr;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 12/23] [AARCH64] Add ILP32 to makefiles
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (10 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 11/23] [AARCH64] Add ILP32 support to elf_machine_load_address Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 13/23] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Yury Norov
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

This patch adds ilp32 and ilp32_be as abi variants to the aarch64 linux
makefile.

* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-variants): Add ilp32
and ilp32_be.
(abi-lp64-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64-condition): Check word size macro also.
(abi-lp64_be-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64_be-condition): Check word size macro also.
(abi-ilp32-options): Define.
(abi-ilp32-condition): Likewise.
(abi-ilp32_be-options): Define.
(abi-ilp32_be-condition): Likewise.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/aarch64/Makefile | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile b/sysdeps/unix/sysv/linux/aarch64/Makefile
index 6b4e620..67619f5 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Makefile
+++ b/sysdeps/unix/sysv/linux/aarch64/Makefile
@@ -23,13 +23,21 @@ endif
 
 abi-variants := lp64
 abi-variants += lp64_be
+abi-variants += ilp32
+abi-variants += ilp32_be
 
 ifeq (,$(filter $(default-abi),$(abi-variants)))
 Unknown ABI, must be one of $(abi-variants)
 endif
 
-abi-lp64-options := -U__AARCH64EB__
-abi-lp64-condition := !defined __AARCH64EB__
+abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
 
-abi-lp64_be-options := -D__AARCH64EB__
-abi-lp64_be-condition := defined __AARCH64EB__
+abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
+
+abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
+
+abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 13/23] [AARCH64] Add support to ldconfig for ILP32 and libilp32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (11 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 12/23] [AARCH64] Add ILP32 to makefiles Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 14/23] [AARCH64] Add ILP32 ld.so to the known interpreter names Yury Norov
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

This patch adds support to ldconfig for libilp32 which is used by
ILP32.

* sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB32): New define.
* elf/cache.c (print_entry): Handle FLAG_AARCH64_LIB32.
* sysdeps/unix/sysv/linux/aarch64/dl-cache.h (_DL_CACHE_DEFAULT_ID):
Define it to be the FLAG_AARCH64_LIB32 if compiling for ILP32.
(add_system_dir): Add libilp32 to the list of system directories.
* sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file):
Handle ILP32 elf binaries.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 elf/cache.c                                |  3 +++
 sysdeps/generic/ldconfig.h                 |  1 +
 sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 ++++++++++++-
 sysdeps/unix/sysv/linux/arm/readelflib.c   |  4 +++-
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/elf/cache.c b/elf/cache.c
index fbee172..a3bfb5d 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -101,6 +101,9 @@ print_entry (const char *lib, int flag, unsigned int osversion,
     case FLAG_AARCH64_LIB64:
       fputs (",AArch64", stdout);
       break;
+    case FLAG_AARCH64_LIB32:
+      fputs (",ILP32", stdout);
+      break;
     /* Uses the ARM soft-float ABI.  */
     case FLAG_ARM_LIBSF:
       fputs (",soft-float", stdout);
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index 07600b7..8150227 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -42,6 +42,7 @@
 #define FLAG_MIPS_LIB32_NAN2008		0x0c00
 #define FLAG_MIPS64_LIBN32_NAN2008	0x0d00
 #define FLAG_MIPS64_LIBN64_NAN2008	0x0e00
+#define FLAG_AARCH64_LIB32		0x0f00
 
 /* Name of auxiliary cache.  */
 #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
index 9c7b271..044fdba 100644
--- a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
@@ -18,7 +18,11 @@
 
 #include <ldconfig.h>
 
+#ifdef __LP64__
 #define _DL_CACHE_DEFAULT_ID    (FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6)
+#else
+#define _DL_CACHE_DEFAULT_ID    (FLAG_AARCH64_LIB32 | FLAG_ELF_LIBC6)
+#endif
 
 #define _dl_cache_check_flags(flags)                    \
   ((flags) == _DL_CACHE_DEFAULT_ID)
@@ -27,18 +31,25 @@
   do								\
     {								\
       size_t len = strlen (dir);				\
-      char path[len + 3];					\
+      char path[len + 6];					\
       memcpy (path, dir, len + 1);				\
       if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6))	\
 	{							\
 	  len -= 2;						\
 	  path[len] = '\0';					\
 	}							\
+      if (len >= 9 && ! memcmp (path + len - 9, "/libilp32", 9))\
+	{							\
+	  len -= 5;						\
+	  path[len] = '\0';					\
+	}							\
       add_dir (path);						\
       if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4))	\
 	{							\
 	  memcpy (path + len, "64", 3);				\
 	  add_dir (path);					\
+	  memcpy (path + len, "ilp32", 6);			\
+	  add_dir (path);					\
 	}							\
     } while (0)
 
diff --git a/sysdeps/unix/sysv/linux/arm/readelflib.c b/sysdeps/unix/sysv/linux/arm/readelflib.c
index e6ae72e..ddbad25 100644
--- a/sysdeps/unix/sysv/linux/arm/readelflib.c
+++ b/sysdeps/unix/sysv/linux/arm/readelflib.c
@@ -41,7 +41,9 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
       ret = process_elf32_file (file_name, lib, flag, osversion, soname,
 				file_contents, file_length);
 
-      if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
+      if (!ret && elf_header->e_machine == EM_AARCH64)
+	*flag = FLAG_AARCH64_LIB32|FLAG_ELF_LIBC6;
+      else if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
 	{
 	  if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
 	    *flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 14/23] [AARCH64] Add ILP32 ld.so to the known interpreter names.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (12 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 13/23] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 15/23] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Yury Norov
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

This patch adds ILP32 ld.so names to the known interpreter names.

* sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES):
Add ilp32 ld.so names.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
index ee91ef8..ac84194 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
@@ -21,6 +21,8 @@
 #define SYSDEP_KNOWN_INTERPRETER_NAMES \
   { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
+  { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
+  { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
 #define SYSDEP_KNOWN_LIBRARY_NAMES \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 15/23] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (13 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 14/23] [AARCH64] Add ILP32 ld.so to the known interpreter names Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories Yury Norov
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

To be support multi-lib with ldd, we need to add a ldd-rewrite.sed file
to rewrite RTLDLIST to include both ld.so's.

* sysdeps/unix/sysv/linux/aarch64/configure.ac (ldd_rewrite_script):
Set.
* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
* sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed: New file.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/aarch64/configure       | 2 ++
 sysdeps/unix/sysv/linux/aarch64/configure.ac    | 2 ++
 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed | 1 +
 3 files changed, 5 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed

diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
index c6fca86..037cef3 100755
--- a/sysdeps/unix/sysv/linux/aarch64/configure
+++ b/sysdeps/unix/sysv/linux/aarch64/configure
@@ -31,3 +31,5 @@ case "$prefix" in
 esac
 fi
 
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
index b37a7eb..245b72f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
+++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
@@ -9,3 +9,5 @@ else
   LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
 fi
 
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
new file mode 100644
index 0000000..2f3bbb9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
@@ -0,0 +1 @@
+s_^\(RTLDLIST=\)\(.*lib/\)\([^/]*\)\(-aarch64\)\(\|\_be\)\(\|\_ilp32\)\(.so\.[0-9.]*\)$_\1"\2\3-aarch64\5\7 \2\3-aarch64\5\_ilp32\7"_
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories.
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (14 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 15/23] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:10   ` Joseph Myers
  2016-06-29  8:43   ` Andreas Schwab
  2016-06-28 16:39 ` [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t Yury Norov
                   ` (11 subsequent siblings)
  27 siblings, 2 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

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

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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (15 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:13   ` Joseph Myers
  2016-06-29 10:10   ` Andreas Schwab
  2016-06-28 16:39 ` [PATCH 18/23] [AARCH64] ILP32: support stat syscall family Yury Norov
                   ` (10 subsequent siblings)
  27 siblings, 2 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Yury Norov, Yury Norov

From: Yury Norov <yury.norov@gmail.com>

ILP32 has 64-bit off_t, to follow modern requirements.
But kernel clears top-halves of input registers. It means
we have to pass corresponding arguments in a pair, like
aarch32 does. In this patch all affected syscalls are redefined.
Most of them are taken from arm code.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |  1 +
 .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c    |  4 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c      | 36 ++++++++++++++++++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c    |  0
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c       |  1 +
 .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |  1 +
 .../sysv/linux/aarch64/ilp32/posix_fadvise64.c     |  2 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |  4 +++
 sysdeps/unix/sysv/linux/aarch64/kernel-features.h  | 27 ++++++++++++++++
 11 files changed, 78 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel-features.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
new file mode 100644
index 0000000..fb5b598
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncatei64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
new file mode 100644
index 0000000..bd0f5fe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
@@ -0,0 +1,4 @@
+#include <sysdeps/unix/sysv/linux/arm/ftruncate64.c>
+
+weak_alias (__ftruncate64, __ftruncate)
+weak_alias (__ftruncate64, ftruncate)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c
new file mode 100644
index 0000000..6e00863
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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 <unistd.h>
+#include <sys/types.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+off_t
+__lseek (int fd, off_t offset, int whence)
+{
+  loff_t res;
+  int rc = INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32),
+                           (off_t) offset, &res, whence);
+  return rc ?: res;
+}
+libc_hidden_def (__lseek)
+weak_alias (__lseek, lseek)
+strong_alias (__lseek, __libc_lseek)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c
deleted file mode 100644
index e69de29..0000000
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c
new file mode 100644
index 0000000..813ab64
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/arm/mmap.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise.c
new file mode 100644
index 0000000..4430e6e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/arm/posix_fadvise.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
new file mode 100644
index 0000000..596c6a1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
@@ -0,0 +1,2 @@
+#define __NR_arm_fadvise64_64 __NR_fadvise64_64
+#include <sysdeps/unix/sysv/linux/arm/posix_fadvise64.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c
new file mode 100644
index 0000000..80170c3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/arm/readahead.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
new file mode 100644
index 0000000..23548a5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
new file mode 100644
index 0000000..56cb37f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
@@ -0,0 +1,4 @@
+#include <sysdeps/unix/sysv/linux/arm/truncate64.c>
+
+weak_alias (truncate64, __truncate)
+weak_alias (truncate64, truncate)
diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel-features.h b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h
new file mode 100644
index 0000000..5b0c44d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h
@@ -0,0 +1,27 @@
+/* Set flags signalling availability of kernel features based on given
+   kernel version number.
+   Copyright (C) 2006-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_next <kernel-features.h>
+
+#ifdef __ILP32__
+/* Define this if your 32-bit syscall API requires 64-bit register
+   pairs to start with an even-number register.  */
+#define __ASSUME_ALIGNED_REGISTER_PAIRS	1
+#endif /* __ILP32__ */
+
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 18/23] [AARCH64] ILP32: support stat syscall family
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (16 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:15   ` Joseph Myers
                     ` (2 more replies)
  2016-06-28 16:39 ` [PATCH 19/23] [AARCH64] delouse input arguments in system functions Yury Norov
                   ` (9 subsequent siblings)
  27 siblings, 3 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Yury Norov, Yury Norov

From: Yury Norov <yury.norov@gmail.com>

stat and statfs structures has their layouts identical to lp64
after changing off_t, ino_t etc sizes to 64-bit. It means we can
pass it to kernel same way as lp64 does.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/aarch64/bits/stat.h        | 195 +++++++++++++++++++++
 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h      |  64 +++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c    |  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c     |  51 ++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  44 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c     |  47 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c   |  47 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c     |  30 ++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c      |  47 +++++
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c    |  47 +++++
 14 files changed, 759 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/stat.h b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h
new file mode 100644
index 0000000..eec6789
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h
@@ -0,0 +1,195 @@
+/* Copyright (C) 1992-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/>.  */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H	1
+
+/* Versions of the `struct stat' data structure.  */
+#define _STAT_VER_KERNEL	0
+#define _STAT_VER_LINUX		0
+#define _STAT_VER		_STAT_VER_KERNEL
+
+/* Versions of the `xmknod' interface.  */
+#define _MKNOD_VER_LINUX	0
+
+#ifdef __ILP32__
+#include <endian.h>
+struct __kernel_timespec
+  {
+    unsigned long long tv_sec;		/* Seconds.  */
+    long long tv_nsec;			/* Nanoseconds.  */
+  };
+#define conv_timespec(u, k) do {	\
+	(u)->tv_sec = (k)->tv_sec;	\
+	(u)->tv_nsec = (k)->tv_nsec;	\
+} while (0)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define __type3264(type, name)	\
+	type (name); type name##_pad
+#else
+#define __type3264(type, name)	\
+	type name##_pad; type name
+#endif
+
+#else
+#define __kernel_timespec timespec
+#define conv_timespec(u, k)
+#define __type3264(type, name) type name
+#endif /* __ILP32__ */
+
+struct stat
+  {
+    __dev_t st_dev;			/* Device.  */
+    __ino_t st_ino;			/* File serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    __dev_t __pad1;
+    __off_t st_size;			/* Size of file, in bytes.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+    int __pad2;
+
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+#ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    union {
+	    struct timespec st_atim;		/* Time of last access.  */
+	    struct __kernel_timespec __st_atim;
+    };
+    union {
+	    struct timespec st_mtim;		/* Time of last modification.  */
+	    struct __kernel_timespec __st_mtim;
+    };
+    union {
+	    struct timespec st_ctim;		/* Time of last status change.  */
+	    struct __kernel_timespec __st_ctim;
+    };
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
+    __type3264(__time_t, st_atime);			/* Time of last access.  */
+    __type3264(unsigned long int, st_atimensec);	/* Nsecs of last access.  */
+    __type3264(__time_t, st_mtime);			/* Time of last modification.  */
+    __type3264(unsigned long int, st_mtimensec);	/* Nsecs of last modification.  */
+    __type3264(__time_t, st_ctime);			/* Time of last status change.  */
+    __type3264(unsigned long int, st_ctimensec);	/* Nsecs of last status change.  */
+#endif
+    int __glibc_reserved[2];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    __dev_t st_dev;			/* Device.  */
+    __ino_t st_ino;			/* File serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    __dev_t __pad1;
+    __off_t st_size;			/* Size of file, in bytes.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+    int __pad2;
+
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+#ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    union {
+	    struct timespec st_atim;		/* Time of last access.  */
+	    struct __kernel_timespec __st_atim;
+    };
+    union {
+	    struct timespec st_mtim;		/* Time of last modification.  */
+	    struct __kernel_timespec __st_mtim;
+    };
+    union {
+	    struct timespec st_ctim;		/* Time of last status.  */
+	    struct __kernel_timespec __st_ctim;
+    };
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
+    __type3264(__time_t, st_atime);			/* Time of last access.  */
+    __type3264(unsigned long int, st_atimensec);	/* Nsecs of last access.  */
+    __type3264(__time_t, st_mtime);			/* Time of last modification.  */
+    __type3264(unsigned long int, st_mtimensec);	/* Nsecs of last modification.  */
+    __type3264(__time_t, st_ctime);			/* Time of last status change.  */
+    __type3264(unsigned long int, st_ctimensec);	/* Nsecs of last status change.  */
+#endif
+    int __glibc_reserved[2];
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
+
+/* Encoding of the file mode.  */
+
+#define	__S_IFMT	0170000	/* These bits determine file type.  */
+
+/* File types.  */
+#define	__S_IFDIR	0040000	/* Directory.  */
+#define	__S_IFCHR	0020000	/* Character device.  */
+#define	__S_IFBLK	0060000	/* Block device.  */
+#define	__S_IFREG	0100000	/* Regular file.  */
+#define	__S_IFIFO	0010000	/* FIFO.  */
+#define	__S_IFLNK	0120000	/* Symbolic link.  */
+#define	__S_IFSOCK	0140000	/* Socket.  */
+
+/* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
+   they do it by enforcing the correct use of the macros.  */
+#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+
+/* Protection bits.  */
+
+#define	__S_ISUID	04000	/* Set user ID on execution.  */
+#define	__S_ISGID	02000	/* Set group ID on execution.  */
+#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
+#define	__S_IREAD	0400	/* Read by owner.  */
+#define	__S_IWRITE	0200	/* Write by owner.  */
+#define	__S_IEXEC	0100	/* Execute by owner.  */
+
+#ifdef __USE_ATFILE
+# define UTIME_NOW	((1l << 30) - 1l)
+# define UTIME_OMIT	((1l << 30) - 2l)
+#endif
+
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/statfs.h b/sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
new file mode 100644
index 0000000..29273a3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
+
+#include <endian.h>
+#include <bits/types.h>
+#include <bits/wordsize.h>
+
+struct statfs
+  {
+    unsigned long long f_type;
+    unsigned long long f_bsize;
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_bavail;
+    __fsfilcnt_t f_files;
+    __fsfilcnt_t f_ffree;
+    __fsid_t f_fsid;
+    unsigned long long f_namelen;
+    unsigned long long f_frsize;
+    unsigned long long f_flags;
+    unsigned long long f_spare[4];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    unsigned long long f_type;
+    unsigned long long f_bsize;
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_bavail;
+    __fsfilcnt_t f_files;
+    __fsfilcnt_t f_ffree;
+    __fsid_t f_fsid;
+    unsigned long long f_namelen;
+    unsigned long long f_frsize;
+    unsigned long long f_flags;
+    unsigned long long f_spare[4];
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define _STATFS_F_NAMELEN
+#define _STATFS_F_FRSIZE
+#define _STATFS_F_FLAGS
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c
new file mode 100644
index 0000000..8e900fd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FD resides.  */
+int
+__fstatfs (int fd, struct statfs *buf)
+{
+  return INLINE_SYSCALL (fstatfs64, 2, fd, buf);
+}
+weak_alias (__fstatfs, fstatfs)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
new file mode 100644
index 0000000..b37d238
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
@@ -0,0 +1,29 @@
+/* Return information about the filesystem on which FD resides.
+   Copyright (C) 1996-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/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FD resides.  */
+int
+__fstatfs64 (int fd, struct statfs64 *buf)
+{
+      return INLINE_SYSCALL (fstatfs64, 2, fd, buf);
+}
+weak_alias (__fstatfs64, fstatfs64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
new file mode 100644
index 0000000..83df0e4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
@@ -0,0 +1,51 @@
+//#include <sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c>
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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 <stddef.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Get information about the file FD in BUF.  */
+int
+__fxstat (int vers, int fd, struct stat *buf)
+{
+  if (vers == _STAT_VER_KERNEL)
+    {
+      int rc = INLINE_SYSCALL (fstat64, 2, fd, buf);
+      if (!rc) {
+	      conv_timespec(&buf->st_atim, &buf->__st_atim);
+	      conv_timespec(&buf->st_mtim, &buf->__st_mtim);
+	      conv_timespec(&buf->st_ctim, &buf->__st_ctim);
+      }
+
+      return rc;
+
+    }
+
+  errno = EINVAL;
+  return -1;
+}
+
+hidden_def (__fxstat)
+weak_alias (__fxstat, _fxstat);
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
new file mode 100644
index 0000000..6e8a583
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
@@ -0,0 +1,44 @@
+/* fxstat64 using Linux fstat64 system call.
+   Copyright (C) 1997-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 <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#include <kernel-features.h>
+
+/* Get information about the file FD in BUF.  */
+
+int
+___fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+  int result;
+  result = INLINE_SYSCALL (fstat64, 2, fd, buf);
+  if (!result) {
+	  conv_timespec(&buf->st_atim, &buf->__st_atim);
+	  conv_timespec(&buf->st_mtim, &buf->__st_mtim);
+	  conv_timespec(&buf->st_ctim, &buf->__st_ctim);
+  }
+  return result;
+}
+strong_alias (___fxstat64, __fxstat64)
+hidden_def (__fxstat64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
new file mode 100644
index 0000000..fb03a7d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
@@ -0,0 +1,48 @@
+//#include <sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c>
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *buf, int flag)
+{
+  if (vers == _STAT_VER_KERNEL)
+    {
+      int rc = INLINE_SYSCALL (fstatat64, 4, fd, file, buf, flag);
+      if (!rc) {
+	      conv_timespec(&buf->st_atim, &buf->__st_atim);
+	      conv_timespec(&buf->st_mtim, &buf->__st_mtim);
+	      conv_timespec(&buf->st_ctim, &buf->__st_ctim);
+      }
+      return rc;
+    }
+
+  errno = EINVAL;
+  return -1;
+}
+libc_hidden_def (__fxstatat)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
new file mode 100644
index 0000000..9d36ff4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
@@ -0,0 +1,52 @@
+//#include <sysdeps/unix/sysv/linux/fxstatat64.c>
+/* Copyright (C) 2005-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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Get information about the file NAME in BUF.  */
+
+int
+__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
+{
+  if (__glibc_unlikely (vers != _STAT_VER_LINUX))
+    return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
+
+  int result;
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag);
+  if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) {
+      conv_timespec(&st->st_atim, &st->__st_atim);
+      conv_timespec(&st->st_mtim, &st->__st_mtim);
+      conv_timespec(&st->st_ctim, &st->__st_ctim);
+      return 0;
+  }
+  else
+    return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result,
+								      err));
+}
+libc_hidden_def (__fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
new file mode 100644
index 0000000..e8de70e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
@@ -0,0 +1,47 @@
+//#include <sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c>
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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 <stddef.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__lxstat (int vers, const char *name, struct stat *buf)
+{
+  if (vers == _STAT_VER_KERNEL)
+    {
+      int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf,
+                               AT_SYMLINK_NOFOLLOW);
+      if (!rc) {
+	      conv_timespec(&buf->st_atim, &buf->__st_atim);
+	      conv_timespec(&buf->st_mtim, &buf->__st_mtim);
+	      conv_timespec(&buf->st_ctim, &buf->__st_ctim);
+      }
+      return rc;
+    }
+  errno = EINVAL;
+  return -1;
+}
+hidden_def (__lxstat)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
new file mode 100644
index 0000000..50de0b1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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 <stddef.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__lxstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  int result;
+  if (vers == _STAT_VER_KERNEL)
+    {
+      int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf,
+                               AT_SYMLINK_NOFOLLOW);
+      if (!rc) {
+	      conv_timespec(&buf->st_atim, &buf->__st_atim);
+	      conv_timespec(&buf->st_mtim, &buf->__st_mtim);
+	      conv_timespec(&buf->st_ctim, &buf->__st_ctim);
+      }
+      return rc;
+    }
+  errno = EINVAL;
+  return -1;
+}
+hidden_def (__lxstat64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c
new file mode 100644
index 0000000..bf70a7a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FILE resides.  */
+int
+__statfs (const char *file, struct statfs *buf)
+{
+  return INLINE_SYSCALL (statfs64, 2, file, buf);
+}
+libc_hidden_def (__statfs)
+weak_alias (__statfs, statfs)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
new file mode 100644
index 0000000..b99ab94
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FILE resides.  */
+int
+__statfs64 (const char *file, struct statfs64 *buf)
+{
+  return INLINE_SYSCALL (statfs64, 2, file, buf);
+}
+weak_alias (__statfs64,statfs64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
new file mode 100644
index 0000000..b4e8423
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
@@ -0,0 +1,47 @@
+//#include <sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c>
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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 <stddef.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__xstat (int vers, const char *name, struct stat *buf)
+{
+  if (vers == _STAT_VER_KERNEL)
+    {
+      int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
+      if (!rc) {
+	      conv_timespec(&buf->st_atim, &buf->__st_atim);
+	      conv_timespec(&buf->st_mtim, &buf->__st_mtim);
+	      conv_timespec(&buf->st_ctim, &buf->__st_ctim);
+      }
+      return rc;
+    }
+
+  errno = EINVAL;
+  return -1;
+}
+hidden_def (__xstat)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
new file mode 100644
index 0000000..e4f4cd5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
@@ -0,0 +1,47 @@
+//#include <sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c>
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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 <stddef.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__xstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  if (vers == _STAT_VER_KERNEL) {
+    int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
+    if (!rc) {
+	    conv_timespec(&buf->st_atim, &buf->__st_atim);
+	    conv_timespec(&buf->st_mtim, &buf->__st_mtim);
+	    conv_timespec(&buf->st_ctim, &buf->__st_ctim);
+    }
+
+    return rc;
+  }
+
+  errno = EINVAL;
+  return -1;
+}
+hidden_def (__xstat64)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 19/23] [AARCH64] delouse input arguments in system functions
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (17 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 18/23] [AARCH64] ILP32: support stat syscall family Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:15   ` Joseph Myers
  2016-06-29  7:49   ` Andreas Schwab
  2016-06-28 16:39 ` [PATCH 20/23] [AARCH64] Fix ILP32 warning Yury Norov
                   ` (8 subsequent siblings)
  27 siblings, 2 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Yury Norov

This patch introduces DELOUSE() macro which does nothing
for lp64, and clears top bits of registers holding inputs,
where needed.

AARCH64/ILP32 needs it because top bits condition is undefined
according to ABI.

'Delouse' term comes from Linux kernel where similar macro does
the same for compat syscall wrapper.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/__longjmp.S                   | 2 ++
 sysdeps/aarch64/dl-tlsdesc.S                  | 8 ++++++++
 sysdeps/aarch64/memcmp.S                      | 3 +++
 sysdeps/aarch64/memcpy.S                      | 8 ++++++++
 sysdeps/aarch64/memset.S                      | 3 +++
 sysdeps/aarch64/setjmp.S                      | 1 +
 sysdeps/aarch64/strchr.S                      | 1 +
 sysdeps/aarch64/strchrnul.S                   | 1 +
 sysdeps/aarch64/strcmp.S                      | 2 ++
 sysdeps/aarch64/strcpy.S                      | 2 ++
 sysdeps/aarch64/strlen.S                      | 2 ++
 sysdeps/aarch64/strncmp.S                     | 3 +++
 sysdeps/aarch64/strnlen.S                     | 3 +++
 sysdeps/aarch64/strrchr.S                     | 1 +
 sysdeps/aarch64/sysdep.h                      | 2 ++
 sysdeps/unix/sysv/linux/aarch64/clone.S       | 7 +++++++
 sysdeps/unix/sysv/linux/aarch64/getcontext.S  | 1 +
 sysdeps/unix/sysv/linux/aarch64/setcontext.S  | 1 +
 sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 1 +
 19 files changed, 52 insertions(+)

diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
index 58332be..0377715 100644
--- a/sysdeps/aarch64/__longjmp.S
+++ b/sysdeps/aarch64/__longjmp.S
@@ -46,6 +46,8 @@ ENTRY (__longjmp)
 	cfi_offset(d14, JB_D14<<3)
 	cfi_offset(d15, JB_D15<<3)
 
+	DELOUSE(0)
+
 	ldp	x19, x20, [x0, #JB_X19<<3]
 	ldp	x21, x22, [x0, #JB_X21<<3]
 	ldp	x23, x24, [x0, #JB_X23<<3]
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index 09cd158..24a110e 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,6 +74,7 @@
 	cfi_startproc
 	.align 2
 _dl_tlsdesc_return:
+	DELOUSE(0)
 	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	RET
 	cfi_endproc
@@ -96,6 +97,7 @@ _dl_tlsdesc_return_lazy:
 	   td->entry) and thus it synchronizes with the release store to
 	   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
 	   from [x0,#PTR_SIZE] here happens after the initialization of td->arg. */
+	DELOUSE(0)
 	ldar	PTR_REG (zr), [x0]
 	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	RET
@@ -125,6 +127,7 @@ _dl_tlsdesc_undefweak:
 	   td->entry) and thus it synchronizes with the release store to
 	   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
 	   from [x0,#8] here happens after the initialization of td->arg.  */
+	DELOUSE(0)
 	ldar	PTR_REG (zr), [x0]
 	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	mrs	x1, tpidr_el0
@@ -174,6 +177,7 @@ _dl_tlsdesc_dynamic:
 	stp	x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
 	cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
 	mov	x29, sp
+	DELOUSE(0)
 
 	/* Save just enough registers to support fast path, if we fall
 	   into slow path we will save additional registers.  */
@@ -188,6 +192,7 @@ _dl_tlsdesc_dynamic:
 	   td->entry) and thus it synchronizes with the release store to
 	   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
 	   from [x0,#PTR_SIZE] here happens after the initialization of td->arg.  */
+	DELOUSE(0)
 	ldar	PTR_REG (zr), [x0]
 	ldr	PTR_REG (1), [x0,#PTR_SIZE]
 	ldr	PTR_REG (0), [x4]
@@ -279,12 +284,14 @@ _dl_tlsdesc_resolve_rela:
 
 	SAVE_Q_REGISTERS
 
+	DELOUSE(3)
 	ldr	PTR_REG (1), [x3, #PTR_SIZE]
 	bl	_dl_tlsdesc_resolve_rela_fixup
 
 	RESTORE_Q_REGISTERS
 
 	ldr	x0, [sp, #32+16*8]
+	DELOUSE(0)
 	ldr	PTR_REG (1), [x0]
 	blr	x1
 
@@ -346,6 +353,7 @@ _dl_tlsdesc_resolve_hold:
 	RESTORE_Q_REGISTERS
 
 	ldr	x0, [sp, #32+16*9]
+	DELOUSE(0)
 	ldr	PTR_REG (1), [x0]
 	blr	x1
 
diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
index ae2d997..982aa02 100644
--- a/sysdeps/aarch64/memcmp.S
+++ b/sysdeps/aarch64/memcmp.S
@@ -47,6 +47,9 @@
 #define mask		x13
 
 ENTRY_ALIGN (memcmp, 6)
+	DELOUSE(0)
+	DELOUSE(1)
+	DELOUSE(2)
 	cbz	limit, L(ret0)
 	eor	tmp1, src1, src2
 	tst	tmp1, #7
diff --git a/sysdeps/aarch64/memcpy.S b/sysdeps/aarch64/memcpy.S
index de73f0f..38a29d6 100644
--- a/sysdeps/aarch64/memcpy.S
+++ b/sysdeps/aarch64/memcpy.S
@@ -61,6 +61,10 @@
 
 ENTRY_ALIGN (memmove, 6)
 
+	DELOUSE(0)
+	DELOUSE(1)
+	DELOUSE(2)
+
 	sub	tmp1, dstin, src
 	cmp	count, 96
 	ccmp	tmp1, count, 2, hi
@@ -71,6 +75,10 @@ END (memmove)
 libc_hidden_builtin_def (memmove)
 ENTRY (memcpy)
 
+	DELOUSE(0)
+	DELOUSE(1)
+	DELOUSE(2)
+
 	prfm	PLDL1KEEP, [src]
 	add	srcend, src, count
 	add	dstend, dstin, count
diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S
index 4d222c5..1cad5c6 100644
--- a/sysdeps/aarch64/memset.S
+++ b/sysdeps/aarch64/memset.S
@@ -39,6 +39,9 @@
 
 ENTRY_ALIGN (__memset, 6)
 
+	DELOUSE(0)
+	DELOUSE(2)
+
 	dup	v0.16B, valw
 	add	dstend, dstin, count
 
diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
index da83f19..d608660 100644
--- a/sysdeps/aarch64/setjmp.S
+++ b/sysdeps/aarch64/setjmp.S
@@ -33,6 +33,7 @@ END (_setjmp)
 libc_hidden_def (_setjmp)
 
 ENTRY (__sigsetjmp)
+	DELOUSE(0)
 
 1:
 	stp	x19, x20, [x0, #JB_X19<<3]
diff --git a/sysdeps/aarch64/strchr.S b/sysdeps/aarch64/strchr.S
index 5e3aecf..838384c 100644
--- a/sysdeps/aarch64/strchr.S
+++ b/sysdeps/aarch64/strchr.S
@@ -62,6 +62,7 @@
 /* Locals and temporaries.  */
 
 ENTRY (strchr)
+	DELOUSE(0)
 	mov	wtmp2, #0x0401
 	movk	wtmp2, #0x4010, lsl #16
 	dup	vrepchr.16b, chrin
diff --git a/sysdeps/aarch64/strchrnul.S b/sysdeps/aarch64/strchrnul.S
index a624c8d..b60df26 100644
--- a/sysdeps/aarch64/strchrnul.S
+++ b/sysdeps/aarch64/strchrnul.S
@@ -60,6 +60,7 @@
    identify exactly which byte is causing the termination.  */
 
 ENTRY (__strchrnul)
+	DELOUSE(0)
 	/* Magic constant 0x40100401 to allow us to identify which lane
 	   matches the termination condition.  */
 	mov	wtmp2, #0x0401
diff --git a/sysdeps/aarch64/strcmp.S b/sysdeps/aarch64/strcmp.S
index ba0ccb4..ccfe281 100644
--- a/sysdeps/aarch64/strcmp.S
+++ b/sysdeps/aarch64/strcmp.S
@@ -49,6 +49,8 @@
 	/* Start of performance-critical section  -- one 64B cache line.  */
 ENTRY_ALIGN(strcmp, 6)
 
+	DELOUSE(0)
+	DELOUSE(1)
 	eor	tmp1, src1, src2
 	mov	zeroones, #REP8_01
 	tst	tmp1, #7
diff --git a/sysdeps/aarch64/strcpy.S b/sysdeps/aarch64/strcpy.S
index 0694199..2a281b9 100644
--- a/sysdeps/aarch64/strcpy.S
+++ b/sysdeps/aarch64/strcpy.S
@@ -91,6 +91,8 @@
 #define MIN_PAGE_SIZE (1 << MIN_PAGE_P2)
 
 ENTRY_ALIGN (STRCPY, 6)
+	DELOUSE(0)
+	DELOUSE(1)
 	/* For moderately short strings, the fastest way to do the copy is to
 	   calculate the length of the string in the same way as strlen, then
 	   essentially do a memcpy of the result.  This avoids the need for
diff --git a/sysdeps/aarch64/strlen.S b/sysdeps/aarch64/strlen.S
index a07834b..d1df0d1 100644
--- a/sysdeps/aarch64/strlen.S
+++ b/sysdeps/aarch64/strlen.S
@@ -85,6 +85,8 @@
 	   boundary.  */
 
 ENTRY_ALIGN (__strlen, 6)
+	DELOUSE(0)
+	DELOUSE(1)
 	and	tmp1, srcin, MIN_PAGE_SIZE - 1
 	mov	zeroones, REP8_01
 	cmp	tmp1, MIN_PAGE_SIZE - 16
diff --git a/sysdeps/aarch64/strncmp.S b/sysdeps/aarch64/strncmp.S
index f6a17fd..a372654 100644
--- a/sysdeps/aarch64/strncmp.S
+++ b/sysdeps/aarch64/strncmp.S
@@ -51,6 +51,9 @@
 #define endloop		x15
 
 ENTRY_ALIGN_AND_PAD (strncmp, 6, 7)
+	DELOUSE(0)
+	DELOUSE(1)
+	DELOUSE(2)
 	cbz	limit, L(ret0)
 	eor	tmp1, src1, src2
 	mov	zeroones, #REP8_01
diff --git a/sysdeps/aarch64/strnlen.S b/sysdeps/aarch64/strnlen.S
index 4cce45f..6f67221 100644
--- a/sysdeps/aarch64/strnlen.S
+++ b/sysdeps/aarch64/strnlen.S
@@ -50,6 +50,9 @@
 #define REP8_80 0x8080808080808080
 
 ENTRY_ALIGN_AND_PAD (__strnlen, 6, 9)
+	DELOUSE(0)
+	DELOUSE(1)
+	DELOUSE(2)
 	cbz	limit, L(hit_limit)
 	mov	zeroones, #REP8_01
 	bic	src, srcin, #15
diff --git a/sysdeps/aarch64/strrchr.S b/sysdeps/aarch64/strrchr.S
index 44c1917..bb85a60 100644
--- a/sysdeps/aarch64/strrchr.S
+++ b/sysdeps/aarch64/strrchr.S
@@ -68,6 +68,7 @@
    identify exactly which byte is causing the termination, and why.  */
 
 ENTRY(strrchr)
+	DELOUSE(0)
 	cbz	x1, L(null_search)
 	/* Magic constant 0x40100401 to allow us to identify which lane
 	   matches the requested byte.  Magic constant 0x80200802 used
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index 4ce0945..c5de4de 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -25,10 +25,12 @@
 # define AARCH64_R(NAME)	R_AARCH64_ ## NAME
 # define PTR_REG(n)		x##n
 # define PTR_LOG_SIZE		3
+# define DELOUSE(n)
 #else
 # define AARCH64_R(NAME)	R_AARCH64_P32_ ## NAME
 # define PTR_REG(n)		w##n
 # define PTR_LOG_SIZE		2
+# define DELOUSE(n)		mov     w##n, w##n
 #endif
 
 #define PTR_SIZE	(1<<PTR_LOG_SIZE)
diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
index 76baa7a..eff6633 100644
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -39,6 +39,13 @@
  */
         .text
 ENTRY(__clone)
+	DELOUSE(0)
+	DELOUSE(1)
+	DELOUSE(2)
+	DELOUSE(3)
+	DELOUSE(4)
+	DELOUSE(5)
+	DELOUSE(6)
 	/* Save args for the child.  */
 	mov	x10, x0
 	mov	x11, x2
diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index 71e526c..35ff326 100644
--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -30,6 +30,7 @@
 	.text
 
 ENTRY(__getcontext)
+	DELOUSE(0)
 	/* The saved context will return to the getcontext() call point
 	   with a return value of 0 */
 	str	xzr,	  [x0, oX0 +  0 * SZREG]
diff --git a/sysdeps/unix/sysv/linux/aarch64/setcontext.S b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
index d17f8c8..7d854bd 100644
--- a/sysdeps/unix/sysv/linux/aarch64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
@@ -34,6 +34,7 @@
 	.text
 
 ENTRY (__setcontext)
+	DELOUSE(0)
 	/* Save a copy of UCP.  */
 	mov	x9, x0
 
diff --git a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
index c1a16f3..764fedc 100644
--- a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
@@ -27,6 +27,7 @@
 
 	.text
 ENTRY(__swapcontext)
+	DELOUSE(0)
 	/* Set the value returned when swapcontext() returns in this context. */
 	str	xzr,      [x0, oX0 +  0 * SZREG]
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 20/23] [AARCH64] Fix ILP32 warning
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (18 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 19/23] [AARCH64] delouse input arguments in system functions Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 16:39 ` [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32 Yury Norov
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Andrew Pinski, Yury Norov

From: Andrew Pinski <apinski@cavium.com>

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/jmpbuf-unwind.h                  | 2 +-
 sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h | 2 +-
 sysdeps/unix/sysv/linux/generic/brk.c            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sysdeps/aarch64/jmpbuf-unwind.h b/sysdeps/aarch64/jmpbuf-unwind.h
index 3e0a37d..11ace17 100644
--- a/sysdeps/aarch64/jmpbuf-unwind.h
+++ b/sysdeps/aarch64/jmpbuf-unwind.h
@@ -27,7 +27,7 @@
   ((void *) (address) < (void *) demangle (jmpbuf[JB_SP]))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(jmpbuf, context, adj) \
-  _JMPBUF_UNWINDS_ADJ (jmpbuf, (void *) _Unwind_GetCFA (context), adj)
+  _JMPBUF_UNWINDS_ADJ (jmpbuf, (void *) (size_t) _Unwind_GetCFA (context), adj)
 
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
   ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
diff --git a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
index a579501..ee54222 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
@@ -19,7 +19,7 @@
 #include <sys/ucontext.h>
 
 #define SIGCONTEXT siginfo_t *_si, struct ucontext *
-#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.pc)
+#define GET_PC(ctx) ((void *) (size_t) (ctx)->uc_mcontext.pc)
 
 /* There is no reliable way to get the sigcontext unless we use a
    three-argument signal handler.  */
diff --git a/sysdeps/unix/sysv/linux/generic/brk.c b/sysdeps/unix/sysv/linux/generic/brk.c
index 1b84004..f369e06 100644
--- a/sysdeps/unix/sysv/linux/generic/brk.c
+++ b/sysdeps/unix/sysv/linux/generic/brk.c
@@ -33,7 +33,7 @@ __brk (void *addr)
 {
   INTERNAL_SYSCALL_DECL (err);
 
-  __curbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
+  __curbrk = (void *) (size_t) INTERNAL_SYSCALL (brk, err, 1, addr);
   if (__curbrk < addr)
     {
       __set_errno (ENOMEM);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (19 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 20/23] [AARCH64] Fix ILP32 warning Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:16   ` Joseph Myers
  2016-06-29  7:55   ` Andreas Schwab
  2016-06-28 16:39 ` [PATCH 22/23] off_t: fix register pair calculation for 64-bit case Yury Norov
                   ` (6 subsequent siblings)
  27 siblings, 2 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Yury Norov

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/aarch64/nptl/bits/semaphore.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/aarch64/nptl/bits/semaphore.h b/sysdeps/aarch64/nptl/bits/semaphore.h
index 3cc5b37..1d1389c 100644
--- a/sysdeps/aarch64/nptl/bits/semaphore.h
+++ b/sysdeps/aarch64/nptl/bits/semaphore.h
@@ -21,7 +21,11 @@
 #endif
 
 
+#ifdef __ILP32__
+#define __SIZEOF_SEM_T	16
+#else
 #define __SIZEOF_SEM_T	32
+#endif
 
 
 /* Value returned if `sem_open' failed.  */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 22/23] off_t: fix register pair calculation for 64-bit case
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (20 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32 Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:17   ` Joseph Myers
  2016-06-28 16:39 ` [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port Yury Norov
                   ` (5 subsequent siblings)
  27 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Yury Norov

There are 3 syscall wrappers under sysdeps/unix/sysv/linux that
calculate register pair for off_t like this:
        __LONG_LONG_PAIR (offset >> 31, offset)

While it works for 32-bit off_t, new 32-bit APIs that use 64-bit
off_t will be broken with it. This patch redirects affected syscalls
to their 64-bit versions. It also saves few instructions and symbols
in glibc, as 32-bit syscall wrappers are not generated anymore.

This patch has also been sent separately and is found correct during
discussion.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/fallocate.c         | 4 ++++
 sysdeps/unix/sysv/linux/fallocate64.c       | 4 ++++
 sysdeps/unix/sysv/linux/posix_fadvise.c     | 4 ++++
 sysdeps/unix/sysv/linux/posix_fadvise64.c   | 4 ++++
 sysdeps/unix/sysv/linux/posix_fallocate.c   | 4 ++++
 sysdeps/unix/sysv/linux/posix_fallocate64.c | 4 ++++
 6 files changed, 24 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/fallocate.c b/sysdeps/unix/sysv/linux/fallocate.c
index 6a58a5f..4ec55a5 100644
--- a/sysdeps/unix/sysv/linux/fallocate.c
+++ b/sysdeps/unix/sysv/linux/fallocate.c
@@ -20,6 +20,8 @@
 #include <sysdep-cancel.h>
 
 
+#ifndef	__OFF_T_MATCHES_OFF64_T
+
 /* Reserve storage for the data of the file associated with FD.  */
 int
 fallocate (int fd, int mode, __off_t offset, __off_t len)
@@ -33,3 +35,5 @@ fallocate (int fd, int mode, __off_t offset, __off_t len)
   return -1;
 #endif
 }
+
+#endif /* __OFF_T_MATCHES_OFF64_T */
diff --git a/sysdeps/unix/sysv/linux/fallocate64.c b/sysdeps/unix/sysv/linux/fallocate64.c
index 8e76d6f..f4f73d5 100644
--- a/sysdeps/unix/sysv/linux/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/fallocate64.c
@@ -35,3 +35,7 @@ fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
   return -1;
 #endif
 }
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+weak_alias(fallocate64, fallocate)
+#endif
diff --git a/sysdeps/unix/sysv/linux/posix_fadvise.c b/sysdeps/unix/sysv/linux/posix_fadvise.c
index 093d707..8356bc7 100644
--- a/sysdeps/unix/sysv/linux/posix_fadvise.c
+++ b/sysdeps/unix/sysv/linux/posix_fadvise.c
@@ -19,6 +19,8 @@
 #include <fcntl.h>
 #include <sysdep.h>
 
+#ifndef	__OFF_T_MATCHES_OFF64_T
+
 /* Advice the system about the expected behaviour of the application with
    respect to the file associated with FD.  */
 
@@ -46,3 +48,5 @@ posix_fadvise (int fd, off_t offset, off_t len, int advise)
   return ENOSYS;
 #endif
 }
+
+#endif /* __OFF_T_MATCHES_OFF64_T */
diff --git a/sysdeps/unix/sysv/linux/posix_fadvise64.c b/sysdeps/unix/sysv/linux/posix_fadvise64.c
index 6d10558..c76d52f 100644
--- a/sysdeps/unix/sysv/linux/posix_fadvise64.c
+++ b/sysdeps/unix/sysv/linux/posix_fadvise64.c
@@ -56,3 +56,7 @@ compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
 #else
 strong_alias (__posix_fadvise64_l64, posix_fadvise64);
 #endif
+
+#ifdef	__OFF_T_MATCHES_OFF64_T
+weak_alias(__posix_fadvise64_l64, __posix_fadvise)
+#endif /* __OFF_T_MATCHES_OFF64_T */
diff --git a/sysdeps/unix/sysv/linux/posix_fallocate.c b/sysdeps/unix/sysv/linux/posix_fallocate.c
index fc9ac37..f9ca34b 100644
--- a/sysdeps/unix/sysv/linux/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/posix_fallocate.c
@@ -18,6 +18,8 @@
 #include <fcntl.h>
 #include <sysdep.h>
 
+#ifndef	__OFF_T_MATCHES_OFF64_T
+
 #define posix_fallocate static internal_fallocate
 #include <sysdeps/posix/posix_fallocate.c>
 #undef posix_fallocate
@@ -37,3 +39,5 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
     return INTERNAL_SYSCALL_ERRNO (res, err);
   return internal_fallocate (fd, offset, len);
 }
+
+#endif /* __OFF_T_MATCHES_OFF64_T */
diff --git a/sysdeps/unix/sysv/linux/posix_fallocate64.c b/sysdeps/unix/sysv/linux/posix_fallocate64.c
index 4a0a722..3a65d35 100644
--- a/sysdeps/unix/sysv/linux/posix_fallocate64.c
+++ b/sysdeps/unix/sysv/linux/posix_fallocate64.c
@@ -40,3 +40,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
     return INTERNAL_SYSCALL_ERRNO (res, err);
   return internal_fallocate64 (fd, offset, len);
 }
+
+#ifdef	__OFF_T_MATCHES_OFF64_T
+weak_alias(__posix_fallocate64_l64, posix_fallocate)
+#endif
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (21 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 22/23] off_t: fix register pair calculation for 64-bit case Yury Norov
@ 2016-06-28 16:39 ` Yury Norov
  2016-06-28 17:18   ` Joseph Myers
  2016-06-28 16:57 ` [RFC2 PATCH 00/23] ARM64: support ILP32 Joseph Myers
                   ` (4 subsequent siblings)
  27 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 16:39 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella, Yury Norov

aarch64 and ilp32 has different size of time_t. So to have common
layout for struct utmp and utmpx, corresponding headers are taken
from s390 port.

This is temporary solution. Proper solution shoud come from generic
code and also take care on endianness.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h  | 1 +
 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/utmp.h b/sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
new file mode 100644
index 0000000..a492a0b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/s390/bits/utmp.h>
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h b/sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h
new file mode 100644
index 0000000..9e890e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/s390/bits/utmpx.h>
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* Re: [RFC2 PATCH 00/23] ARM64: support ILP32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (22 preceding siblings ...)
  2016-06-28 16:39 ` [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port Yury Norov
@ 2016-06-28 16:57 ` Joseph Myers
  2016-06-28 17:31 ` Adhemerval Zanella
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 16:57 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

On Tue, 28 Jun 2016, Yury Norov wrote:

>  - addressed v1 comments (I'm really sorry if I missed something,
>    there are a lot of them, and I am really thankfull for detailed review);

You appear to have ignored most of my comments, including comments carried 
over from 2014.  Please check more thoroughly for any message on 
libc-alpha since the first patch series was posted in Oct 2014 that 
relates to AArch64 ILP32 patches (both comments on such patch series, and 
patches other people posted since the 2014 series that build on top of 
it), and make sure that it is addressed.  If you think a comment is 
incorrect, say so explicitly.

> Tested with LTP. Regressions are like this:

As I said in <https://sourceware.org/ml/libc-alpha/2016-06/msg00780.html>, 
test with the glibc testsuite and report the glibc testsuite results.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32
  2016-06-28 16:39 ` [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32 Yury Norov
@ 2016-06-28 17:00   ` Joseph Myers
  2016-06-28 17:30     ` Joseph Myers
  0 siblings, 1 reply; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:00 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

On Tue, 28 Jun 2016, Yury Norov wrote:

> diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h

See what I said in 
<https://sourceware.org/ml/libc-alpha/2016-06/msg00786.html> about "make 
other bits/wordsize.h files define the macro to 0".  This patch would 
break all other architectures (and AArch64 LP64 - you should test build 
and testsuite for that, as well as ILP32, and confirm that there are no 
testsuite regressions for LP64).

> +/* Copyright (C) 2014 Free Software Foundation, Inc.

See what I said in 
<https://sourceware.org/ml/libc-alpha/2016-06/msg00780.html> about 
one-line descriptions before copyright notices.  Please check every new 
file in every patch in the series for this issue.

All copyright notices should have ranges of years that end in 2016.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 03/23] Add dynamic ILP32 AARCH64 relocations to elf.h
  2016-06-28 16:39 ` [PATCH 03/23] Add dynamic ILP32 AARCH64 relocations to elf.h Yury Norov
@ 2016-06-28 17:03   ` Joseph Myers
  0 siblings, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:03 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

On Tue, 28 Jun 2016, Yury Norov wrote:

> From: Andrew Pinski <apinski@cavium.com>
> 
> elf/elf.h (R_AARCH64_P32_ABS32, R_AARCH64_P32_COPY,
> R_AARCH64_P32_GLOB_DAT, R_AARCH64_P32_JUMP_SLOT,
> R_AARCH64_P32_RELATIVE, R_AARCH64_P32_TLS_DTPMOD,
> R_AARCH64_P32_TLS_DTPREL, R_AARCH64_P32_TLS_TPREL,
> R_AARCH64_P32_TLSDESC, R_AARCH64_P32_IRELATIVE): Define.

See what I said in 
<https://sourceware.org/ml/libc-alpha/2016-06/msg00783.html>.  The patch 
subject and ChangeLog entries seem to have no relation to the patch 
contents.

Before posting any new patch series, please check that every patch 
description is accurate for the patch in question, both the subject line 
and the detailed description, and that you have a unified ChangeLog stanza 
that is also up to date for the change being posted.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 05/23] [AARCH64] Use PTR_REG in crti.S.
  2016-06-28 16:39 ` [PATCH 05/23] [AARCH64] Use PTR_REG in crti.S Yury Norov
@ 2016-06-28 17:05   ` Joseph Myers
  0 siblings, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:05 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

On Tue, 28 Jun 2016, Yury Norov wrote:

> From: Andrew Pinski <apinski@cavium.com>
> 
> call_weak_fn loads from a pointer, so use PTR_REG so the load
> is 32bits for ILP32.
> 
> * sysdeps/aarch64/crti.S: Include sysdep.h
> (call_weak_fn): Use PTR_REG when loading from
> PREINIT_FUNCTION.
> 
> AARCH64: Make RTLD_START paramatizable
> 
> Make RTLD_START paramatizable for ILP32 and LP64 usage and provides common
> code between ILP32.
> 
> * sysdeps/aarch64/dl-machine.h (RTLD_START): Rename to ...
> (RTLD_START_1): This and add PTR, PTR_SIZE_LOG, and PTR_SP arguments.
> (RTLD_START): New macro which uses RTLD_START_1.

See what I said in 
<https://sourceware.org/ml/libc-alpha/2016-06/msg00783.html> about unified 
ChangeLog stanzas.

Subject

Long description


yyyy-mm-dd  Author  <email>

	* file: description.
	* file2: description.
	...

*Not* separate alternating long descriptions and ChangeLog entries.  If 
the changes are logically separable, post them separately.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 06/23] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
  2016-06-28 16:39 ` [PATCH 06/23] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Yury Norov
@ 2016-06-28 17:06   ` Joseph Myers
  0 siblings, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:06 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

On Tue, 28 Jun 2016, Yury Norov wrote:

> * sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
> (_dl_tlsdesc_dynamic)		: Use PTR_REG, PTR_SIZE.
> (_dl_tlsdesc_resolve_hold)	: Likewise.
> (_dl_tlsdesc_resolve_rela)	: Likewise.
> (_dl_tlsdesc_return_lazy)	: Likewise.
> (_dl_tlsdesc_undefweak)		: Likewise.

Note this is incorrect ChangeLog formatting.  No spaces before ':' and 
each line should be indented by one TAB.  Please check formatting in all 
patches.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts.
  2016-06-28 16:39 ` [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts Yury Norov
@ 2016-06-28 17:07   ` Joseph Myers
  2016-06-28 17:26     ` Yury Norov
  0 siblings, 1 reply; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:07 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

<https://sourceware.org/ml/libc-alpha/2016-06/msg00785.html> and 
<https://sourceware.org/ml/libc-alpha/2014-10/msg00639.html> still apply.  
Please make the changes requested there before any reposting of the patch 
series.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories.
  2016-06-28 16:39 ` [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories Yury Norov
@ 2016-06-28 17:10   ` Joseph Myers
  2016-06-29  8:43   ` Andreas Schwab
  1 sibling, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:10 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

<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.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t
  2016-06-28 16:39 ` [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t Yury Norov
@ 2016-06-28 17:13   ` Joseph Myers
  2016-06-29 10:10   ` Andreas Schwab
  1 sibling, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:13 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

On Tue, 28 Jun 2016, Yury Norov wrote:

> ILP32 has 64-bit off_t, to follow modern requirements.
> But kernel clears top-halves of input registers. It means
> we have to pass corresponding arguments in a pair, like
> aarch32 does. In this patch all affected syscalls are redefined.
> Most of them are taken from arm code.

Please follow the spirit of Adhemerval's recent work.  Determine the 
appropriate abstractions for the architecture differences for these 
syscalls, and set up unified implementations used on all architectures, 
rather than increasing the number of architecture-specific variants.

> +#ifdef __ILP32__
> +/* Define this if your 32-bit syscall API requires 64-bit register
> +   pairs to start with an even-number register.  */
> +#define __ASSUME_ALIGNED_REGISTER_PAIRS	1
> +#endif /* __ILP32__ */

Preprocessor indentation.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 18/23] [AARCH64] ILP32: support stat syscall family
  2016-06-28 16:39 ` [PATCH 18/23] [AARCH64] ILP32: support stat syscall family Yury Norov
@ 2016-06-28 17:15   ` Joseph Myers
  2016-06-28 19:08     ` Yury Norov
  2016-06-29  6:57   ` Andreas Schwab
  2016-06-29  9:20   ` Andreas Schwab
  2 siblings, 1 reply; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:15 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

<https://sourceware.org/ml/libc-alpha/2016-06/msg00791.html> still 
applies.  Unify implementations instead of proliferating variants.

Also, much of the formatting is way off the GNU Coding Standards (e.g. 
indentation that's not two-column, "{" not on a line by itself), and 
you're missing descriptions as first lines of many new files.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 19/23] [AARCH64] delouse input arguments in system functions
  2016-06-28 16:39 ` [PATCH 19/23] [AARCH64] delouse input arguments in system functions Yury Norov
@ 2016-06-28 17:15   ` Joseph Myers
  2016-06-29  7:49   ` Andreas Schwab
  1 sibling, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:15 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

Missing spaces before '(' in macro calls.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
  2016-06-28 16:39 ` [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32 Yury Norov
@ 2016-06-28 17:16   ` Joseph Myers
  2016-06-29  7:55   ` Andreas Schwab
  1 sibling, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:16 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

Missing preprocessor indentation.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 22/23] off_t: fix register pair calculation for 64-bit case
  2016-06-28 16:39 ` [PATCH 22/23] off_t: fix register pair calculation for 64-bit case Yury Norov
@ 2016-06-28 17:17   ` Joseph Myers
  0 siblings, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:17 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

On Tue, 28 Jun 2016, Yury Norov wrote:

> +weak_alias(__posix_fadvise64_l64, __posix_fadvise)

Missing space before '('.

> +weak_alias(__posix_fallocate64_l64, posix_fallocate)

Likewise.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port
  2016-06-28 16:39 ` [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port Yury Norov
@ 2016-06-28 17:18   ` Joseph Myers
  2016-06-28 17:59     ` Yury Norov
  0 siblings, 1 reply; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:18 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

On Tue, 28 Jun 2016, Yury Norov wrote:

> aarch64 and ilp32 has different size of time_t. So to have common
> layout for struct utmp and utmpx, corresponding headers are taken
> from s390 port.

You can't #include installed headers from other ports like this; it 
wouldn't work when using an installed library.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts.
  2016-06-28 17:07   ` Joseph Myers
@ 2016-06-28 17:26     ` Yury Norov
  2016-06-28 17:35       ` Joseph Myers
  0 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-06-28 17:26 UTC (permalink / raw)
  To: Joseph Myers
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

On Tue, Jun 28, 2016 at 05:07:49PM +0000, Joseph Myers wrote:
> <https://sourceware.org/ml/libc-alpha/2016-06/msg00785.html> and 
> <https://sourceware.org/ml/libc-alpha/2014-10/msg00639.html> still apply.  
> Please make the changes requested there before any reposting of the patch 
> series.

Yes, I forgot about glibc version. I don't want to add changelogs
because I think patches order should/may be changed, and as all that
changelogs touch single file, there will be nightmare to rebase
series.

>> diff --git a/sysdeps/aarch64/preconfigure
>> b/sysdeps/aarch64/preconfigure
>> index d9bd1f8..4bcd8e3 100644
>> --- a/sysdeps/aarch64/preconfigure
>> +++ b/sysdeps/aarch64/preconfigure
>> @@ -1,6 +1,15 @@
>>  case "$machine" in
>>  aarch64*)
>>       base_machine=aarch64
>> -     machine=aarch64
>> +     case "$CC $CFLAGS $CPPFLAGS " in
>> +             *" -mabi=ilp32 "*) aarch64_config_abi=ilp32 ;;
>> +             *" -mabi=lp64 "*) aarch64_config_abi=lp64 ;;
>> +             *) aarch64_config_abi=default ;;
>> +     esac
>> +     case $aarch64_config_abi in
>> +             default) machine=aarch64/lp64 aarch64_config_abi=lp64
>> ;;
> 
> It would seem better to test how the compiler behaves (what it 
> predefines), as now done for MIPS, so that this works with a compiler 
> configured --with-abi=ilp32 without needing to add an explicit ABI
> option 
> to CC or CFLAGS.

I didn't understand what you mean here and forgot to ask.
I didn't work much on glibc, and not familiar to it's build
system. Could you explain it little more detailed please?

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32
  2016-06-28 17:00   ` Joseph Myers
@ 2016-06-28 17:30     ` Joseph Myers
  0 siblings, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:30 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

On Tue, 28 Jun 2016, Joseph Myers wrote:

> On Tue, 28 Jun 2016, Yury Norov wrote:
> 
> > diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
> 
> See what I said in 
> <https://sourceware.org/ml/libc-alpha/2016-06/msg00786.html> about "make 
> other bits/wordsize.h files define the macro to 0".  This patch would 
> break all other architectures (and AArch64 LP64 - you should test build 
> and testsuite for that, as well as ILP32, and confirm that there are no 
> testsuite regressions for LP64).

(Actually, for LP64, if you can confirm that the installed stripped shared 
libraries are byte-for-byte identical before and after the patch series, 
then a testsuite run is unnecessary.  But you still need to run the 
testsuite for ILP32, and justify any failures there, and if the LP64 
binaries aren't byte-for-byte identical, you should justify why they 
aren't.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [RFC2 PATCH 00/23] ARM64: support ILP32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (23 preceding siblings ...)
  2016-06-28 16:57 ` [RFC2 PATCH 00/23] ARM64: support ILP32 Joseph Myers
@ 2016-06-28 17:31 ` Adhemerval Zanella
  2016-07-05  7:33 ` Andreas Schwab
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 59+ messages in thread
From: Adhemerval Zanella @ 2016-06-28 17:31 UTC (permalink / raw)
  To: Yury Norov, libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools

Hi Yury,

Please address all previous reviews comment and concerns before send
a new RFC/patch set.  As Joseph pointed out, he raised different question
in different patch iterations (some even back from 2014) and there is
no point is just resent the same patch without first review such
comments.

On 28/06/2016 13:39, Yury Norov wrote:
> This series enables aarch64 port with ilp32 mode.
> 
> ABI details:
>  - types are taken from AARCH32, next types turned to 64-bit,
>    as modern requirement for new APIs tells:
> 	ino_t      is  u64 type
> 	off_t      is  s64 type
> 	blkcnt_t   is  s64 type
> 	fsblkcnt_t is  u64 type
> 	fsfilcnt_t is  u64 type
>  - 64-bit arguments are passed in syscall as register pair,
>    as kernel internally clears top halves for all input regs;
>  - standard syscall table is used;
>  - 32-bit time_t is used. AARCH64/ILP32 is waiting for general
>    fix of Y2038 problem just like other 32-bit arches;
>  - stat{64}, statfs{64} structures are of the identical layout
>    with LP64. Corresponding syscalls are taken from 64-bit code
>  - struct utmp, utmpx layouts are the same.
> 
> v1: https://sourceware.org/ml/libc-alpha/2016-06/msg00730.html
> v2:
>  - rebased on master;
>  - dropped unneeded/unrelated patches;
>  - pread family platform implementation removed;
>  - addressed v1 comments (I'm really sorry if I missed something,
>    there are a lot of them, and I am really thankfull for detailed review);
> 
> Tested with LTP. Regressions are like this:
> abort01                        FAIL       2
> kill11                         FAIL       2
> mmap16                         FAIL       6
> open12                         FAIL       2
> rename11                       FAIL       2
> rmdir02                        FAIL       2
> umount2_01                     FAIL       2
> umount2_02                     FAIL       2
> umount2_03                     FAIL       2
> utime06                        FAIL       2
> 
> It's better than v1, and there are ~5 additional regressions comparing to
> aarch64, all are related to filesystem.
> 
> Andrew Pinski (17):
>   [AARCH64] define word size for lp64 and ilp32
>   [AARCH64] Add header guards to sysdep.h headers.
>   Add dynamic ILP32 AARCH64 relocations to elf.h
>   [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in
>     LDST_PCREL and LDST_GLOBAL.
>   [AARCH64] Use PTR_REG in crti.S.
>   [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
>   [AARCH64] Use PTR_* macros in dl-trampoline.S
>   [AARCH64] Use PTR_* in start.S
>   [AARCH64] Use PTR_REG in getcontext.S.
>   [AARCH64] Detect ILP32 in configure scripts.
>   [AARCH64] Add ILP32 support to elf_machine_load_address.
>   [AARCH64] Add ILP32 to makefiles
>   [AARCH64] Add support to ldconfig for ILP32 and libilp32
>   [AARCH64] Add ILP32 ld.so to the known interpreter names.
>   [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
>   [AARCH64] Make lp64 and ilp32 directories.
>   [AARCH64] Fix ILP32 warning
> 
> Yury Norov (6):
>   [AARCH64] ILP32: introduce syscalls that pass off_t
>   [AARCH64] ILP32: support stat syscall family
>   [AARCH64] delouse input arguments in system functions
>   [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
>   off_t: fix register pair calculation for 64-bit case
>   [AARCH64] Take utmp{,x}.h from s390 port
> 
>  elf/cache.c                                        |   3 +
>  sysdeps/aarch64/Implies                            |   6 -
>  sysdeps/aarch64/__longjmp.S                        |   6 +-
>  sysdeps/aarch64/bits/wordsize.h                    |  25 +++
>  sysdeps/aarch64/configure                          |  15 +-
>  sysdeps/aarch64/configure.ac                       |  11 +-
>  sysdeps/aarch64/crti.S                             |   3 +-
>  sysdeps/aarch64/dl-irel.h                          |   3 +-
>  sysdeps/aarch64/dl-machine.h                       | 199 ++++++++++++---------
>  sysdeps/aarch64/dl-tlsdesc.S                       |  56 +++---
>  sysdeps/aarch64/dl-trampoline.S                    |  18 +-
>  sysdeps/aarch64/ilp32/Implies                      |   6 +
>  sysdeps/aarch64/jmpbuf-unwind.h                    |   2 +-
>  sysdeps/aarch64/lp64/Implies                       |   7 +
>  sysdeps/aarch64/memcmp.S                           |   3 +
>  sysdeps/aarch64/memcpy.S                           |   8 +
>  sysdeps/aarch64/memset.S                           |   3 +
>  sysdeps/aarch64/nptl/bits/semaphore.h              |   4 +
>  sysdeps/aarch64/preconfigure                       |  11 +-
>  sysdeps/aarch64/setjmp.S                           |   5 +-
>  sysdeps/aarch64/start.S                            |  20 ++-
>  sysdeps/aarch64/strchr.S                           |   1 +
>  sysdeps/aarch64/strchrnul.S                        |   1 +
>  sysdeps/aarch64/strcmp.S                           |   2 +
>  sysdeps/aarch64/strcpy.S                           |   2 +
>  sysdeps/aarch64/strlen.S                           |   2 +
>  sysdeps/aarch64/strncmp.S                          |   3 +
>  sysdeps/aarch64/strnlen.S                          |   3 +
>  sysdeps/aarch64/strrchr.S                          |   1 +
>  sysdeps/aarch64/sysdep.h                           |  39 +++-
>  sysdeps/generic/ldconfig.h                         |   1 +
>  sysdeps/generic/stdint.h                           |   9 +-
>  sysdeps/unix/sysv/linux/aarch64/Implies            |   2 -
>  sysdeps/unix/sysv/linux/aarch64/Makefile           |  16 +-
>  sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h       |   6 +-
>  sysdeps/unix/sysv/linux/aarch64/bits/stat.h        | 195 ++++++++++++++++++++
>  sysdeps/unix/sysv/linux/aarch64/bits/statfs.h      |  64 +++++++
>  sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   |  86 +++++++++
>  sysdeps/unix/sysv/linux/aarch64/bits/utmp.h        |   1 +
>  sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h       |   1 +
>  sysdeps/unix/sysv/linux/aarch64/clone.S            |   7 +
>  sysdeps/unix/sysv/linux/aarch64/configure          |  24 ++-
>  sysdeps/unix/sysv/linux/aarch64/configure.ac       |  11 +-
>  sysdeps/unix/sysv/linux/aarch64/dl-cache.h         |  13 +-
>  sysdeps/unix/sysv/linux/aarch64/getcontext.S       |   3 +-
>  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/fstatfs.c    |  29 +++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  29 +++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |   1 +
>  .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c    |   4 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c     |  51 ++++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  44 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   |  77 ++++++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c      |  36 ++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c     |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c   |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c       |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c     |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c     |  32 ++++
>  .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |   1 +
>  .../sysv/linux/aarch64/ilp32/posix_fadvise64.c     |   2 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |   1 +
>  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 ++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c     |  30 ++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
>  .../unix/sysv/linux/aarch64/ilp32/syscalls.list    |   0
>  sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |   4 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c      |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c    |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ioctl.S            |  31 ----
>  sysdeps/unix/sysv/linux/aarch64/kernel-features.h  |  27 +++
>  sysdeps/unix/sysv/linux/aarch64/ldconfig.h         |   2 +
>  sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed    |   1 +
>  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/setcontext.S       |   1 +
>  sysdeps/unix/sysv/linux/aarch64/shlib-versions     |   7 -
>  sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h   |   2 +-
>  sysdeps/unix/sysv/linux/aarch64/swapcontext.S      |   1 +
>  sysdeps/unix/sysv/linux/aarch64/sysdep.h           |   8 +-
>  sysdeps/unix/sysv/linux/arm/readelflib.c           |   4 +-
>  sysdeps/unix/sysv/linux/fallocate.c                |   4 +
>  sysdeps/unix/sysv/linux/fallocate64.c              |   4 +
>  sysdeps/unix/sysv/linux/generic/brk.c              |   2 +-
>  sysdeps/unix/sysv/linux/posix_fadvise.c            |   4 +
>  sysdeps/unix/sysv/linux/posix_fadvise64.c          |   4 +
>  sysdeps/unix/sysv/linux/posix_fallocate.c          |   4 +
>  sysdeps/unix/sysv/linux/posix_fallocate64.c        |   4 +
>  100 files changed, 1649 insertions(+), 250 deletions(-)
>  delete mode 100644 sysdeps/aarch64/Implies
>  create mode 100644 sysdeps/aarch64/bits/wordsize.h
>  mode change 100644 => 100755 sysdeps/aarch64/configure
>  create mode 100644 sysdeps/aarch64/ilp32/Implies
>  create mode 100644 sysdeps/aarch64/lp64/Implies
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h
>  mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
>  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/fstatfs.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.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/lseek.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.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/posix_fadvise.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.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/statfs.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
>  delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel-features.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
>  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
> 

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts.
  2016-06-28 17:26     ` Yury Norov
@ 2016-06-28 17:35       ` Joseph Myers
  0 siblings, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 17:35 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

On Tue, 28 Jun 2016, Yury Norov wrote:

> On Tue, Jun 28, 2016 at 05:07:49PM +0000, Joseph Myers wrote:
> > <https://sourceware.org/ml/libc-alpha/2016-06/msg00785.html> and 
> > <https://sourceware.org/ml/libc-alpha/2014-10/msg00639.html> still apply.  
> > Please make the changes requested there before any reposting of the patch 
> > series.
> 
> Yes, I forgot about glibc version. I don't want to add changelogs
> because I think patches order should/may be changed, and as all that
> changelogs touch single file, there will be nightmare to rebase
> series.

The convention is that you include the ChangeLog entry as part of the 
patch description, rather than changing the ChangeLog file, to avoid this 
issue.  But with the formatting exactly matching what would go in the 
ChangeLog file, so that for the final commit you just need to update the 
date in it and then prepend to the ChangeLog file.

> >> diff --git a/sysdeps/aarch64/preconfigure
> >> b/sysdeps/aarch64/preconfigure
> >> index d9bd1f8..4bcd8e3 100644
> >> --- a/sysdeps/aarch64/preconfigure
> >> +++ b/sysdeps/aarch64/preconfigure
> >> @@ -1,6 +1,15 @@
> >>  case "$machine" in
> >>  aarch64*)
> >>       base_machine=aarch64
> >> -     machine=aarch64
> >> +     case "$CC $CFLAGS $CPPFLAGS " in
> >> +             *" -mabi=ilp32 "*) aarch64_config_abi=ilp32 ;;
> >> +             *" -mabi=lp64 "*) aarch64_config_abi=lp64 ;;
> >> +             *) aarch64_config_abi=default ;;
> >> +     esac
> >> +     case $aarch64_config_abi in
> >> +             default) machine=aarch64/lp64 aarch64_config_abi=lp64
> >> ;;
> > 
> > It would seem better to test how the compiler behaves (what it 
> > predefines), as now done for MIPS, so that this works with a compiler 
> > configured --with-abi=ilp32 without needing to add an explicit ABI
> > option 
> > to CC or CFLAGS.
> 
> I didn't understand what you mean here and forgot to ask.
> I didn't work much on glibc, and not familiar to it's build
> system. Could you explain it little more detailed please?

See sysdeps/mips/preconfigure.  It runs $CC $CFLAGS $CPPFLAGS -E -dM -xc 
/dev/null and extracts predefined macros that relate to the ABI from the 
output.  This avoids needing to hardcode anything about what the default 
ABI might be for a compiler if neither -mabi= option is passed.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port
  2016-06-28 17:18   ` Joseph Myers
@ 2016-06-28 17:59     ` Yury Norov
  2016-06-28 20:38       ` Joseph Myers
  2016-06-28 20:43       ` Adhemerval Zanella
  0 siblings, 2 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 17:59 UTC (permalink / raw)
  To: Joseph Myers
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

On Tue, Jun 28, 2016 at 05:18:04PM +0000, Joseph Myers wrote:
> On Tue, 28 Jun 2016, Yury Norov wrote:
> 
> > aarch64 and ilp32 has different size of time_t. So to have common
> > layout for struct utmp and utmpx, corresponding headers are taken
> > from s390 port.
> 
> You can't #include installed headers from other ports like this; it 
> wouldn't work when using an installed library.
> 
> -- 
> Joseph S. Myers
> joseph@codesourcery.com

So I should copy? Hmm...

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 18/23] [AARCH64] ILP32: support stat syscall family
  2016-06-28 17:15   ` Joseph Myers
@ 2016-06-28 19:08     ` Yury Norov
  2016-06-28 20:41       ` Adhemerval Zanella
  2016-06-28 20:46       ` Joseph Myers
  0 siblings, 2 replies; 59+ messages in thread
From: Yury Norov @ 2016-06-28 19:08 UTC (permalink / raw)
  To: Joseph Myers
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

On Tue, Jun 28, 2016 at 05:15:13PM +0000, Joseph Myers wrote:
> <https://sourceware.org/ml/libc-alpha/2016-06/msg00791.html> still 
> applies.  Unify implementations instead of proliferating variants.

I think on it. I don't see simple way to unify it right now. And I
plan to take a vacation in next two weeks, so I'd like to share my 
progress to community (mostly for kernel), as this series has some
LTP tests fixed, and this is important for us.

What you talk about sounds unclear to me. If you mean to unify with
one of existing ports, it looks unnecessary, as ilp32 will end up with 
RISC-V anyway. If you mean to use RISC-V, it's not ready yet. I was
thinking that when they will finish, they simply switch this port to
their code. Am I too optimistic?

> Also, much of the formatting is way off the GNU Coding Standards (e.g. 
> indentation that's not two-column, "{" not on a line by itself), and 
> you're missing descriptions as first lines of many new files.

Is there glibc analogue for kernel scripts/checkpatch.pl? If yes,
please point me out, and I'll briefly fix all issues. If no please be
patient to whitespace rules violations. I completely understand the
importance of following the coding rules, but now I am little limited
in time and prefer to fix real bugs first, and then read that document
carefully and check all the mess I introduced.

Yury

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port
  2016-06-28 17:59     ` Yury Norov
@ 2016-06-28 20:38       ` Joseph Myers
  2016-06-28 20:43       ` Adhemerval Zanella
  1 sibling, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 20:38 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

On Tue, 28 Jun 2016, Yury Norov wrote:

> > You can't #include installed headers from other ports like this; it 
> > wouldn't work when using an installed library.
> > 
> > -- 
> > Joseph S. Myers
> > joseph@codesourcery.com
> 
> So I should copy? Hmm...

Yes, unless you can develop an additional abstraction to describe the 
differences between architectures, so that all architectures can share the 
same bits/utmp.h and bits/utmpx.h and there's only a smaller header that 
needs copying.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 18/23] [AARCH64] ILP32: support stat syscall family
  2016-06-28 19:08     ` Yury Norov
@ 2016-06-28 20:41       ` Adhemerval Zanella
  2016-06-28 20:46       ` Joseph Myers
  1 sibling, 0 replies; 59+ messages in thread
From: Adhemerval Zanella @ 2016-06-28 20:41 UTC (permalink / raw)
  To: Yury Norov, Joseph Myers
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, Yury Norov



On 28/06/2016 16:08, Yury Norov wrote:
> On Tue, Jun 28, 2016 at 05:15:13PM +0000, Joseph Myers wrote:
>> <https://sourceware.org/ml/libc-alpha/2016-06/msg00791.html> still 
>> applies.  Unify implementations instead of proliferating variants.
> 
> I think on it. I don't see simple way to unify it right now. And I
> plan to take a vacation in next two weeks, so I'd like to share my 
> progress to community (mostly for kernel), as this series has some
> LTP tests fixed, and this is important for us.
> 
> What you talk about sounds unclear to me. If you mean to unify with
> one of existing ports, it looks unnecessary, as ilp32 will end up with 
> RISC-V anyway. If you mean to use RISC-V, it's not ready yet. I was
> thinking that when they will finish, they simply switch this port to
> their code. Am I too optimistic?

The idea is to avoid the proliferation of multiple implementation of
same function over multiple files.  This have the advantage to make
easy for new ports to add such functionality and simplify the code
base.  Take fstatfs{64} for instance:

$ find . -iname fstatfs*
./sysdeps/mach/hurd/fstatfs.c
./sysdeps/mach/hurd/fstatfs64.c
./sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c
./sysdeps/unix/sysv/linux/alpha/fstatfs64.c
./sysdeps/unix/sysv/linux/fstatfs64.c
./sysdeps/unix/sysv/linux/wordsize-64/fstatfs64.c
./sysdeps/unix/sysv/linux/mips/mips64/n64/fstatfs64.c
./io/fstatfs.c
./io/fstatfs64.c

The 'io' is the default one which is just a stub that return ENOSYS.
For Linux ideally we should aim to have just one implementation that
cover all the architectures/kernel limitation (the same idea I am
pushing with some consolidation patches).

It might be outside the scope of the port enablement, but it is usually
the opportunity to the refactor on such code.  And for such functions
it might require some work for some architecture idiosyncrasies (such
as alpha not providing fstat64), but I think it quite doable. 


> 
>> Also, much of the formatting is way off the GNU Coding Standards (e.g. 
>> indentation that's not two-column, "{" not on a line by itself), and 
>> you're missing descriptions as first lines of many new files.
> 
> Is there glibc analogue for kernel scripts/checkpatch.pl? If yes,
> please point me out, and I'll briefly fix all issues. If no please be
> patient to whitespace rules violations. I completely understand the
> importance of following the coding rules, but now I am little limited
> in time and prefer to fix real bugs first, and then read that document
> carefully and check all the mess I introduced.

Also keep in mind to remove the 'Contributed by ...' presented in some
files.

> 
> Yury
> 

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port
  2016-06-28 17:59     ` Yury Norov
  2016-06-28 20:38       ` Joseph Myers
@ 2016-06-28 20:43       ` Adhemerval Zanella
  1 sibling, 0 replies; 59+ messages in thread
From: Adhemerval Zanella @ 2016-06-28 20:43 UTC (permalink / raw)
  To: Yury Norov, Joseph Myers
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools



On 28/06/2016 14:59, Yury Norov wrote:
> On Tue, Jun 28, 2016 at 05:18:04PM +0000, Joseph Myers wrote:
>> On Tue, 28 Jun 2016, Yury Norov wrote:
>>
>>> aarch64 and ilp32 has different size of time_t. So to have common
>>> layout for struct utmp and utmpx, corresponding headers are taken
>>> from s390 port.
>>
>> You can't #include installed headers from other ports like this; it 
>> wouldn't work when using an installed library.
>>
>> -- 
>> Joseph S. Myers
>> joseph@codesourcery.com
> 
> So I should copy? Hmm...
> 

In this case yes, since the reference will be broken because the s390
won't be installed.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 18/23] [AARCH64] ILP32: support stat syscall family
  2016-06-28 19:08     ` Yury Norov
  2016-06-28 20:41       ` Adhemerval Zanella
@ 2016-06-28 20:46       ` Joseph Myers
  1 sibling, 0 replies; 59+ messages in thread
From: Joseph Myers @ 2016-06-28 20:46 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	pinskia, bamvor.zhangjian, schwab, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

On Tue, 28 Jun 2016, Yury Norov wrote:

> What you talk about sounds unclear to me. If you mean to unify with
> one of existing ports, it looks unnecessary, as ilp32 will end up with 
> RISC-V anyway. If you mean to use RISC-V, it's not ready yet. I was
> thinking that when they will finish, they simply switch this port to
> their code. Am I too optimistic?

I mean unify in sysdeps/unix/sysv/linux (or .../generic if inappropriate 
for the main sysdeps/unix/sysv/linux), for all architectures, both 
existing and new, with conditionals based on logical features of the 
architectures.  If any architecture has its own implementation, it should 
only be old architectures with their special peculiarities.

> Is there glibc analogue for kernel scripts/checkpatch.pl? If yes,
> please point me out, and I'll briefly fix all issues. If no please be

I'm not aware of an analogue, although GCC's contrib/check_GNU_style.sh 
may well be helpful for some issues.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 18/23] [AARCH64] ILP32: support stat syscall family
  2016-06-28 16:39 ` [PATCH 18/23] [AARCH64] ILP32: support stat syscall family Yury Norov
  2016-06-28 17:15   ` Joseph Myers
@ 2016-06-29  6:57   ` Andreas Schwab
  2016-06-29  9:20   ` Andreas Schwab
  2 siblings, 0 replies; 59+ messages in thread
From: Andreas Schwab @ 2016-06-29  6:57 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

Yury Norov <ynorov@caviumnetworks.com> writes:

> +#ifdef __ILP32__
> +#include <endian.h>
> +struct __kernel_timespec
> +  {
> +    unsigned long long tv_sec;		/* Seconds.  */
> +    long long tv_nsec;			/* Nanoseconds.  */
> +  };
> +#define conv_timespec(u, k) do {	\
> +	(u)->tv_sec = (k)->tv_sec;	\
> +	(u)->tv_nsec = (k)->tv_nsec;	\
> +} while (0)
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +#define __type3264(type, name)	\
> +	type (name); type name##_pad
> +#else
> +#define __type3264(type, name)	\
> +	type name##_pad; type name
> +#endif
> +
> +#else
> +#define __kernel_timespec timespec
> +#define conv_timespec(u, k)
> +#define __type3264(type, name) type name
> +#endif /* __ILP32__ */

Surely conv_timespec needs to be put in an internal header.

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."

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 19/23] [AARCH64] delouse input arguments in system functions
  2016-06-28 16:39 ` [PATCH 19/23] [AARCH64] delouse input arguments in system functions Yury Norov
  2016-06-28 17:15   ` Joseph Myers
@ 2016-06-29  7:49   ` Andreas Schwab
  1 sibling, 0 replies; 59+ messages in thread
From: Andreas Schwab @ 2016-06-29  7:49 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

Yury Norov <ynorov@caviumnetworks.com> writes:

> @@ -174,6 +177,7 @@ _dl_tlsdesc_dynamic:
>  	stp	x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
>  	cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
>  	mov	x29, sp
> +	DELOUSE(0)
>  
>  	/* Save just enough registers to support fast path, if we fall
>  	   into slow path we will save additional registers.  */
> @@ -188,6 +192,7 @@ _dl_tlsdesc_dynamic:
>  	   td->entry) and thus it synchronizes with the release store to
>  	   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
>  	   from [x0,#PTR_SIZE] here happens after the initialization of td->arg.  */
> +	DELOUSE(0)

Once is enough.

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."

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
  2016-06-28 16:39 ` [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32 Yury Norov
  2016-06-28 17:16   ` Joseph Myers
@ 2016-06-29  7:55   ` Andreas Schwab
  1 sibling, 0 replies; 59+ messages in thread
From: Andreas Schwab @ 2016-06-29  7:55 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

The same can be done for the pthread types, following the x32 example.

Andreas.

diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
index 13984a7..49bb402 100644
--- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
@@ -21,16 +21,27 @@
 
 #include <endian.h>
 
-#define __SIZEOF_PTHREAD_ATTR_T        64
-#define __SIZEOF_PTHREAD_MUTEX_T       48
-#define __SIZEOF_PTHREAD_MUTEXATTR_T    8
-#define __SIZEOF_PTHREAD_COND_T        48
-#define __SIZEOF_PTHREAD_COND_COMPAT_T 48
-#define __SIZEOF_PTHREAD_CONDATTR_T     8
-#define __SIZEOF_PTHREAD_RWLOCK_T      56
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
-#define __SIZEOF_PTHREAD_BARRIER_T     32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T  8
+#if __ILP32__
+# define __SIZEOF_PTHREAD_ATTR_T        32
+# define __SIZEOF_PTHREAD_MUTEX_T       32
+# define __SIZEOF_PTHREAD_MUTEXATTR_T    4
+# define __SIZEOF_PTHREAD_COND_T        48
+# define __SIZEOF_PTHREAD_CONDATTR_T     4
+# define __SIZEOF_PTHREAD_RWLOCK_T      44
+# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
+# define __SIZEOF_PTHREAD_BARRIER_T     20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T  4
+#else
+# define __SIZEOF_PTHREAD_ATTR_T        64
+# define __SIZEOF_PTHREAD_MUTEX_T       48
+# define __SIZEOF_PTHREAD_MUTEXATTR_T    8
+# define __SIZEOF_PTHREAD_COND_T        48
+# define __SIZEOF_PTHREAD_CONDATTR_T     8
+# define __SIZEOF_PTHREAD_RWLOCK_T      56
+# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
+# define __SIZEOF_PTHREAD_BARRIER_T     32
+# define __SIZEOF_PTHREAD_BARRIERATTR_T  8
+#endif
 
 
 /* Thread identifiers.  The structure of the attribute type is not
-- 
2.9.0

-- 
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."

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* Re: [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories.
  2016-06-28 16:39 ` [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories Yury Norov
  2016-06-28 17:10   ` Joseph Myers
@ 2016-06-29  8:43   ` Andreas Schwab
  1 sibling, 0 replies; 59+ messages in thread
From: Andreas Schwab @ 2016-06-29  8:43 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Andrew Pinski

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.

-- 
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."

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 18/23] [AARCH64] ILP32: support stat syscall family
  2016-06-28 16:39 ` [PATCH 18/23] [AARCH64] ILP32: support stat syscall family Yury Norov
  2016-06-28 17:15   ` Joseph Myers
  2016-06-29  6:57   ` Andreas Schwab
@ 2016-06-29  9:20   ` Andreas Schwab
  2 siblings, 0 replies; 59+ messages in thread
From: Andreas Schwab @ 2016-06-29  9:20 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

../sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c: In function '__lxstat64':
../sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c:32:7: error: unused variable 'result' [-Werror=unused-variable]
   int result;
       ^~~~~~

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."

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t
  2016-06-28 16:39 ` [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t Yury Norov
  2016-06-28 17:13   ` Joseph Myers
@ 2016-06-29 10:10   ` Andreas Schwab
  2016-06-29 12:04     ` Andreas Schwab
  1 sibling, 1 reply; 59+ messages in thread
From: Andreas Schwab @ 2016-06-29 10:10 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

rpm: ../sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c:31: __libc_pread: Assertion `sizeof (offset) == 4' failed.

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."

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t
  2016-06-29 10:10   ` Andreas Schwab
@ 2016-06-29 12:04     ` Andreas Schwab
  0 siblings, 0 replies; 59+ messages in thread
From: Andreas Schwab @ 2016-06-29 12:04 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella, Yury Norov

Sorry, I was trying to backport to 2.23, and failed.  Won't happen
again.

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."

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [RFC2 PATCH 00/23] ARM64: support ILP32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (24 preceding siblings ...)
  2016-06-28 17:31 ` Adhemerval Zanella
@ 2016-07-05  7:33 ` Andreas Schwab
  2016-07-08 15:12 ` Yury Norov
  2016-09-08  4:25 ` Zhangjian (Bamvor)
  27 siblings, 0 replies; 59+ messages in thread
From: Andreas Schwab @ 2016-07-05  7:33 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, bamvor.zhangjian, fweimer, Prasun.Kapoor,
	cmetcalf, hjl.tools, adhemerval.zanella

Yury Norov <ynorov@caviumnetworks.com> writes:

> ABI details:
>  - types are taken from AARCH32, next types turned to 64-bit,
>    as modern requirement for new APIs tells:
> 	ino_t      is  u64 type
> 	off_t      is  s64 type
> 	blkcnt_t   is  s64 type
> 	fsblkcnt_t is  u64 type
> 	fsfilcnt_t is  u64 type

This is missing rlim_t, which is also controlled by _FILE_OFFSET_BITS.

Andreas.

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
index 39c0c81..b386abe 100644
--- a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
@@ -36,7 +36,7 @@
 #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 __RLIM_T_TYPE		__UQUAD_TYPE
 #define __RLIM64_T_TYPE		__UQUAD_TYPE
 #define	__BLKCNT_T_TYPE		__SQUAD_TYPE
 #define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit.c
new file mode 100644
index 0000000..b460f45
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
new file mode 100644
index 0000000..1bf982c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
@@ -0,0 +1,11 @@
+#define getrlimit __hide_getrlimit
+#define __getrlimit __hide___getrlimit
+#include <sysdeps/unix/sysv/linux/getrlimit64.c>
+#undef getrlimit
+#undef __getrlimit
+
+extern __typeof (__getrlimit64) __getrlimit;
+libc_hidden_proto (__getrlimit)
+strong_alias (__getrlimit64, __getrlimit)
+libc_hidden_def (__getrlimit)
+weak_alias (__getrlimit, getrlimit)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/prlimit.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/prlimit.c
new file mode 100644
index 0000000..161589a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/prlimit.c
@@ -0,0 +1 @@
+/* prlimit is the same as prlimit64.  */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit.c
new file mode 100644
index 0000000..ae9983c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
new file mode 100644
index 0000000..e8fb138
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
@@ -0,0 +1,11 @@
+#define setrlimit64 __setrlimit64
+#define setrlimit __hide_setrlimit
+#define __setrlimit __hide___setrlimit
+#include <sysdeps/unix/sysv/linux/setrlimit64.c>
+#undef setrlimit64
+#undef setrlimit
+#undef __setrlimit
+
+strong_alias (__setrlimit64, __setrlimit)
+weak_alias (__setrlimit64, setrlimit64)
+weak_alias (__setrlimit, setrlimit)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list b/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
index e69de29..5fc55b4 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
@@ -0,0 +1 @@
+prlimit64	EXTRA	prlimit64	i:iipp	prlimit64	prlimit
-- 
2.9.0


-- 
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."

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* Re: [RFC2 PATCH 00/23] ARM64: support ILP32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (25 preceding siblings ...)
  2016-07-05  7:33 ` Andreas Schwab
@ 2016-07-08 15:12 ` Yury Norov
  2016-09-08  4:25 ` Zhangjian (Bamvor)
  27 siblings, 0 replies; 59+ messages in thread
From: Yury Norov @ 2016-07-08 15:12 UTC (permalink / raw)
  To: libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, bamvor.zhangjian,
	schwab, fweimer, Prasun.Kapoor, cmetcalf, hjl.tools,
	adhemerval.zanella

Hi all,

I take 2-week vacation from monday, so I'll be not available all the
time, and may response with one or two days delay.

Yury.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [RFC2 PATCH 00/23] ARM64: support ILP32
  2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
                   ` (26 preceding siblings ...)
  2016-07-08 15:12 ` Yury Norov
@ 2016-09-08  4:25 ` Zhangjian (Bamvor)
  2016-09-08 11:37   ` Yury Norov
  27 siblings, 1 reply; 59+ messages in thread
From: Zhangjian (Bamvor) @ 2016-09-08  4:25 UTC (permalink / raw)
  To: Yury Norov, libc-alpha, linux-kernel
  Cc: arnd, catalin.marinas, marcus.shawcroft, philb, davem,
	szabolcs.nagy, maxim.kuvyrkov, joseph, pinskia, schwab, fweimer,
	Prasun.Kapoor, cmetcalf, hjl.tools, adhemerval.zanella,
	Zhangjian (Bamvor), Bamvor Zhang Jian, jijun (D),
	Hanjun Guo

Hi, Guys

There was a discussion about bump vdso version of kernel. We need
update the vdso version in glibc correspondingly otherwise the
application could not make use of the vdso.

Is it make sense to you?

Regards

Bamvor

commit 3ffc1d798fc25ccb02e7cc325fe5fb3890c085e3
Author: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Date:   Thu Sep 8 12:21:16 2016 +0800

     [AARCH64] ILP32: bump vdso version consistent with kernel

     Signed-off-by: Jun Ji <jijun2@huawei.com>
     Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>

diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c
index f7224a2..3e4eaad 100644
--- a/sysdeps/unix/sysv/linux/aarch64/init-first.c
+++ b/sysdeps/unix/sysv/linux/aarch64/init-first.c
@@ -27,17 +27,21 @@ int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
  static inline void
  _libc_vdso_platform_setup (void)
  {
-  PREPARE_VERSION (linux2639, "LINUX_2.6.39", 123718537);
+#ifndef __ILP32__
+  PREPARE_VERSION (linux, "LINUX_2.6.39", 123718537);
+#else
+  PREPARE_VERSION (linux, "LINUX_4.8", 61765624);
+#endif /* #ifndef __ILP32__ */

-  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2639);
+  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux);
    PTR_MANGLE (p);
    VDSO_SYMBOL(gettimeofday) = p;

-  p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2639);
+  p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux);
    PTR_MANGLE (p);
    VDSO_SYMBOL(clock_gettime) = p;

-  p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2639);
+  p = _dl_vdso_vsym ("__kernel_clock_getres", &linux);
    PTR_MANGLE (p);
    VDSO_SYMBOL(clock_getres) = p;
  }


On 2016/6/29 0:39, Yury Norov wrote:
> This series enables aarch64 port with ilp32 mode.
>
> ABI details:
>  - types are taken from AARCH32, next types turned to 64-bit,
>    as modern requirement for new APIs tells:
> 	ino_t      is  u64 type
> 	off_t      is  s64 type
> 	blkcnt_t   is  s64 type
> 	fsblkcnt_t is  u64 type
> 	fsfilcnt_t is  u64 type
>  - 64-bit arguments are passed in syscall as register pair,
>    as kernel internally clears top halves for all input regs;
>  - standard syscall table is used;
>  - 32-bit time_t is used. AARCH64/ILP32 is waiting for general
>    fix of Y2038 problem just like other 32-bit arches;
>  - stat{64}, statfs{64} structures are of the identical layout
>    with LP64. Corresponding syscalls are taken from 64-bit code
>  - struct utmp, utmpx layouts are the same.
>
> v1: https://sourceware.org/ml/libc-alpha/2016-06/msg00730.html
> v2:
>  - rebased on master;
>  - dropped unneeded/unrelated patches;
>  - pread family platform implementation removed;
>  - addressed v1 comments (I'm really sorry if I missed something,
>    there are a lot of them, and I am really thankfull for detailed review);
>
> Tested with LTP. Regressions are like this:
> abort01                        FAIL       2
> kill11                         FAIL       2
> mmap16                         FAIL       6
> open12                         FAIL       2
> rename11                       FAIL       2
> rmdir02                        FAIL       2
> umount2_01                     FAIL       2
> umount2_02                     FAIL       2
> umount2_03                     FAIL       2
> utime06                        FAIL       2
>
> It's better than v1, and there are ~5 additional regressions comparing to
> aarch64, all are related to filesystem.
>
> Andrew Pinski (17):
>   [AARCH64] define word size for lp64 and ilp32
>   [AARCH64] Add header guards to sysdep.h headers.
>   Add dynamic ILP32 AARCH64 relocations to elf.h
>   [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in
>     LDST_PCREL and LDST_GLOBAL.
>   [AARCH64] Use PTR_REG in crti.S.
>   [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
>   [AARCH64] Use PTR_* macros in dl-trampoline.S
>   [AARCH64] Use PTR_* in start.S
>   [AARCH64] Use PTR_REG in getcontext.S.
>   [AARCH64] Detect ILP32 in configure scripts.
>   [AARCH64] Add ILP32 support to elf_machine_load_address.
>   [AARCH64] Add ILP32 to makefiles
>   [AARCH64] Add support to ldconfig for ILP32 and libilp32
>   [AARCH64] Add ILP32 ld.so to the known interpreter names.
>   [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
>   [AARCH64] Make lp64 and ilp32 directories.
>   [AARCH64] Fix ILP32 warning
>
> Yury Norov (6):
>   [AARCH64] ILP32: introduce syscalls that pass off_t
>   [AARCH64] ILP32: support stat syscall family
>   [AARCH64] delouse input arguments in system functions
>   [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
>   off_t: fix register pair calculation for 64-bit case
>   [AARCH64] Take utmp{,x}.h from s390 port
>
>  elf/cache.c                                        |   3 +
>  sysdeps/aarch64/Implies                            |   6 -
>  sysdeps/aarch64/__longjmp.S                        |   6 +-
>  sysdeps/aarch64/bits/wordsize.h                    |  25 +++
>  sysdeps/aarch64/configure                          |  15 +-
>  sysdeps/aarch64/configure.ac                       |  11 +-
>  sysdeps/aarch64/crti.S                             |   3 +-
>  sysdeps/aarch64/dl-irel.h                          |   3 +-
>  sysdeps/aarch64/dl-machine.h                       | 199 ++++++++++++---------
>  sysdeps/aarch64/dl-tlsdesc.S                       |  56 +++---
>  sysdeps/aarch64/dl-trampoline.S                    |  18 +-
>  sysdeps/aarch64/ilp32/Implies                      |   6 +
>  sysdeps/aarch64/jmpbuf-unwind.h                    |   2 +-
>  sysdeps/aarch64/lp64/Implies                       |   7 +
>  sysdeps/aarch64/memcmp.S                           |   3 +
>  sysdeps/aarch64/memcpy.S                           |   8 +
>  sysdeps/aarch64/memset.S                           |   3 +
>  sysdeps/aarch64/nptl/bits/semaphore.h              |   4 +
>  sysdeps/aarch64/preconfigure                       |  11 +-
>  sysdeps/aarch64/setjmp.S                           |   5 +-
>  sysdeps/aarch64/start.S                            |  20 ++-
>  sysdeps/aarch64/strchr.S                           |   1 +
>  sysdeps/aarch64/strchrnul.S                        |   1 +
>  sysdeps/aarch64/strcmp.S                           |   2 +
>  sysdeps/aarch64/strcpy.S                           |   2 +
>  sysdeps/aarch64/strlen.S                           |   2 +
>  sysdeps/aarch64/strncmp.S                          |   3 +
>  sysdeps/aarch64/strnlen.S                          |   3 +
>  sysdeps/aarch64/strrchr.S                          |   1 +
>  sysdeps/aarch64/sysdep.h                           |  39 +++-
>  sysdeps/generic/ldconfig.h                         |   1 +
>  sysdeps/generic/stdint.h                           |   9 +-
>  sysdeps/unix/sysv/linux/aarch64/Implies            |   2 -
>  sysdeps/unix/sysv/linux/aarch64/Makefile           |  16 +-
>  sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h       |   6 +-
>  sysdeps/unix/sysv/linux/aarch64/bits/stat.h        | 195 ++++++++++++++++++++
>  sysdeps/unix/sysv/linux/aarch64/bits/statfs.h      |  64 +++++++
>  sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   |  86 +++++++++
>  sysdeps/unix/sysv/linux/aarch64/bits/utmp.h        |   1 +
>  sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h       |   1 +
>  sysdeps/unix/sysv/linux/aarch64/clone.S            |   7 +
>  sysdeps/unix/sysv/linux/aarch64/configure          |  24 ++-
>  sysdeps/unix/sysv/linux/aarch64/configure.ac       |  11 +-
>  sysdeps/unix/sysv/linux/aarch64/dl-cache.h         |  13 +-
>  sysdeps/unix/sysv/linux/aarch64/getcontext.S       |   3 +-
>  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/fstatfs.c    |  29 +++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  29 +++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |   1 +
>  .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c    |   4 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c     |  51 ++++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  44 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   |  77 ++++++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c      |  36 ++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c     |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c   |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c       |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c     |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c     |  32 ++++
>  .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |   1 +
>  .../sysv/linux/aarch64/ilp32/posix_fadvise64.c     |   2 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |   1 +
>  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 ++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c     |  30 ++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
>  .../unix/sysv/linux/aarch64/ilp32/syscalls.list    |   0
>  sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |   1 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |   4 +
>  sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c      |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c    |  47 +++++
>  sysdeps/unix/sysv/linux/aarch64/ioctl.S            |  31 ----
>  sysdeps/unix/sysv/linux/aarch64/kernel-features.h  |  27 +++
>  sysdeps/unix/sysv/linux/aarch64/ldconfig.h         |   2 +
>  sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed    |   1 +
>  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/setcontext.S       |   1 +
>  sysdeps/unix/sysv/linux/aarch64/shlib-versions     |   7 -
>  sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h   |   2 +-
>  sysdeps/unix/sysv/linux/aarch64/swapcontext.S      |   1 +
>  sysdeps/unix/sysv/linux/aarch64/sysdep.h           |   8 +-
>  sysdeps/unix/sysv/linux/arm/readelflib.c           |   4 +-
>  sysdeps/unix/sysv/linux/fallocate.c                |   4 +
>  sysdeps/unix/sysv/linux/fallocate64.c              |   4 +
>  sysdeps/unix/sysv/linux/generic/brk.c              |   2 +-
>  sysdeps/unix/sysv/linux/posix_fadvise.c            |   4 +
>  sysdeps/unix/sysv/linux/posix_fadvise64.c          |   4 +
>  sysdeps/unix/sysv/linux/posix_fallocate.c          |   4 +
>  sysdeps/unix/sysv/linux/posix_fallocate64.c        |   4 +
>  100 files changed, 1649 insertions(+), 250 deletions(-)
>  delete mode 100644 sysdeps/aarch64/Implies
>  create mode 100644 sysdeps/aarch64/bits/wordsize.h
>  mode change 100644 => 100755 sysdeps/aarch64/configure
>  create mode 100644 sysdeps/aarch64/ilp32/Implies
>  create mode 100644 sysdeps/aarch64/lp64/Implies
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h
>  mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
>  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/fstatfs.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.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/lseek.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.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/posix_fadvise.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.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/statfs.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
>  delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel-features.h
>  create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
>  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
>

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* Re: [RFC2 PATCH 00/23] ARM64: support ILP32
  2016-09-08  4:25 ` Zhangjian (Bamvor)
@ 2016-09-08 11:37   ` Yury Norov
  2016-09-08 11:51     ` Zhangjian (Bamvor)
  0 siblings, 1 reply; 59+ messages in thread
From: Yury Norov @ 2016-09-08 11:37 UTC (permalink / raw)
  To: Zhangjian (Bamvor)
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, schwab, fweimer, Prasun.Kapoor, cmetcalf,
	hjl.tools, adhemerval.zanella, Bamvor Zhang Jian, jijun (D),
	Hanjun Guo

On Thu, Sep 08, 2016 at 12:25:27PM +0800, Zhangjian (Bamvor) wrote:
> Hi, Guys
> 
> There was a discussion about bump vdso version of kernel. We need
> update the vdso version in glibc correspondingly otherwise the
> application could not make use of the vdso.
> 
> Is it make sense to you?
> 
> Regards
> 
> Bamvor

Hi Bamvor,

Is this the source of performance loss you've discovered?

> 
> commit 3ffc1d798fc25ccb02e7cc325fe5fb3890c085e3
> Author: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
> Date:   Thu Sep 8 12:21:16 2016 +0800
> 
>     [AARCH64] ILP32: bump vdso version consistent with kernel
> 
>     Signed-off-by: Jun Ji <jijun2@huawei.com>
>     Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
> 
> diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c
> index f7224a2..3e4eaad 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/init-first.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/init-first.c
> @@ -27,17 +27,21 @@ int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
>  static inline void
>  _libc_vdso_platform_setup (void)
>  {
> -  PREPARE_VERSION (linux2639, "LINUX_2.6.39", 123718537);
> +#ifndef __ILP32__
> +  PREPARE_VERSION (linux, "LINUX_2.6.39", 123718537);
> +#else
> +  PREPARE_VERSION (linux, "LINUX_4.8", 61765624);
> +#endif /* #ifndef __ILP32__ */
> 
> -  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2639);
> +  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux);
>    PTR_MANGLE (p);
>    VDSO_SYMBOL(gettimeofday) = p;
> 
> -  p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2639);
> +  p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux);
>    PTR_MANGLE (p);
>    VDSO_SYMBOL(clock_gettime) = p;
> 
> -  p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2639);
> +  p = _dl_vdso_vsym ("__kernel_clock_getres", &linux);
>    PTR_MANGLE (p);
>    VDSO_SYMBOL(clock_getres) = p;
>  }
> 
> 
> On 2016/6/29 0:39, Yury Norov wrote:
> >This series enables aarch64 port with ilp32 mode.
> >
> >ABI details:
> > - types are taken from AARCH32, next types turned to 64-bit,
> >   as modern requirement for new APIs tells:
> >	ino_t      is  u64 type
> >	off_t      is  s64 type
> >	blkcnt_t   is  s64 type
> >	fsblkcnt_t is  u64 type
> >	fsfilcnt_t is  u64 type
> > - 64-bit arguments are passed in syscall as register pair,
> >   as kernel internally clears top halves for all input regs;
> > - standard syscall table is used;
> > - 32-bit time_t is used. AARCH64/ILP32 is waiting for general
> >   fix of Y2038 problem just like other 32-bit arches;
> > - stat{64}, statfs{64} structures are of the identical layout
> >   with LP64. Corresponding syscalls are taken from 64-bit code
> > - struct utmp, utmpx layouts are the same.
> >
> >v1: https://sourceware.org/ml/libc-alpha/2016-06/msg00730.html
> >v2:
> > - rebased on master;
> > - dropped unneeded/unrelated patches;
> > - pread family platform implementation removed;
> > - addressed v1 comments (I'm really sorry if I missed something,
> >   there are a lot of them, and I am really thankfull for detailed review);
> >
> >Tested with LTP. Regressions are like this:
> >abort01                        FAIL       2
> >kill11                         FAIL       2
> >mmap16                         FAIL       6
> >open12                         FAIL       2
> >rename11                       FAIL       2
> >rmdir02                        FAIL       2
> >umount2_01                     FAIL       2
> >umount2_02                     FAIL       2
> >umount2_03                     FAIL       2
> >utime06                        FAIL       2
> >
> >It's better than v1, and there are ~5 additional regressions comparing to
> >aarch64, all are related to filesystem.
> >
> >Andrew Pinski (17):
> >  [AARCH64] define word size for lp64 and ilp32
> >  [AARCH64] Add header guards to sysdep.h headers.
> >  Add dynamic ILP32 AARCH64 relocations to elf.h
> >  [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in
> >    LDST_PCREL and LDST_GLOBAL.
> >  [AARCH64] Use PTR_REG in crti.S.
> >  [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
> >  [AARCH64] Use PTR_* macros in dl-trampoline.S
> >  [AARCH64] Use PTR_* in start.S
> >  [AARCH64] Use PTR_REG in getcontext.S.
> >  [AARCH64] Detect ILP32 in configure scripts.
> >  [AARCH64] Add ILP32 support to elf_machine_load_address.
> >  [AARCH64] Add ILP32 to makefiles
> >  [AARCH64] Add support to ldconfig for ILP32 and libilp32
> >  [AARCH64] Add ILP32 ld.so to the known interpreter names.
> >  [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
> >  [AARCH64] Make lp64 and ilp32 directories.
> >  [AARCH64] Fix ILP32 warning
> >
> >Yury Norov (6):
> >  [AARCH64] ILP32: introduce syscalls that pass off_t
> >  [AARCH64] ILP32: support stat syscall family
> >  [AARCH64] delouse input arguments in system functions
> >  [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
> >  off_t: fix register pair calculation for 64-bit case
> >  [AARCH64] Take utmp{,x}.h from s390 port
> >
> > elf/cache.c                                        |   3 +
> > sysdeps/aarch64/Implies                            |   6 -
> > sysdeps/aarch64/__longjmp.S                        |   6 +-
> > sysdeps/aarch64/bits/wordsize.h                    |  25 +++
> > sysdeps/aarch64/configure                          |  15 +-
> > sysdeps/aarch64/configure.ac                       |  11 +-
> > sysdeps/aarch64/crti.S                             |   3 +-
> > sysdeps/aarch64/dl-irel.h                          |   3 +-
> > sysdeps/aarch64/dl-machine.h                       | 199 ++++++++++++---------
> > sysdeps/aarch64/dl-tlsdesc.S                       |  56 +++---
> > sysdeps/aarch64/dl-trampoline.S                    |  18 +-
> > sysdeps/aarch64/ilp32/Implies                      |   6 +
> > sysdeps/aarch64/jmpbuf-unwind.h                    |   2 +-
> > sysdeps/aarch64/lp64/Implies                       |   7 +
> > sysdeps/aarch64/memcmp.S                           |   3 +
> > sysdeps/aarch64/memcpy.S                           |   8 +
> > sysdeps/aarch64/memset.S                           |   3 +
> > sysdeps/aarch64/nptl/bits/semaphore.h              |   4 +
> > sysdeps/aarch64/preconfigure                       |  11 +-
> > sysdeps/aarch64/setjmp.S                           |   5 +-
> > sysdeps/aarch64/start.S                            |  20 ++-
> > sysdeps/aarch64/strchr.S                           |   1 +
> > sysdeps/aarch64/strchrnul.S                        |   1 +
> > sysdeps/aarch64/strcmp.S                           |   2 +
> > sysdeps/aarch64/strcpy.S                           |   2 +
> > sysdeps/aarch64/strlen.S                           |   2 +
> > sysdeps/aarch64/strncmp.S                          |   3 +
> > sysdeps/aarch64/strnlen.S                          |   3 +
> > sysdeps/aarch64/strrchr.S                          |   1 +
> > sysdeps/aarch64/sysdep.h                           |  39 +++-
> > sysdeps/generic/ldconfig.h                         |   1 +
> > sysdeps/generic/stdint.h                           |   9 +-
> > sysdeps/unix/sysv/linux/aarch64/Implies            |   2 -
> > sysdeps/unix/sysv/linux/aarch64/Makefile           |  16 +-
> > sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h       |   6 +-
> > sysdeps/unix/sysv/linux/aarch64/bits/stat.h        | 195 ++++++++++++++++++++
> > sysdeps/unix/sysv/linux/aarch64/bits/statfs.h      |  64 +++++++
> > sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   |  86 +++++++++
> > sysdeps/unix/sysv/linux/aarch64/bits/utmp.h        |   1 +
> > sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h       |   1 +
> > sysdeps/unix/sysv/linux/aarch64/clone.S            |   7 +
> > sysdeps/unix/sysv/linux/aarch64/configure          |  24 ++-
> > sysdeps/unix/sysv/linux/aarch64/configure.ac       |  11 +-
> > sysdeps/unix/sysv/linux/aarch64/dl-cache.h         |  13 +-
> > sysdeps/unix/sysv/linux/aarch64/getcontext.S       |   3 +-
> > 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/fstatfs.c    |  29 +++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  29 +++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |   1 +
> > .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c    |   4 +
> > sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c     |  51 ++++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  44 +++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   |  77 ++++++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |   1 +
> > sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c      |  36 ++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c     |  47 +++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c   |  47 +++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c       |   1 +
> > sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c     |   1 +
> > sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c     |  32 ++++
> > .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |   1 +
> > .../sysv/linux/aarch64/ilp32/posix_fadvise64.c     |   2 +
> > sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |   1 +
> > 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 ++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c     |  30 ++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
> > .../unix/sysv/linux/aarch64/ilp32/syscalls.list    |   0
> > sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |   1 +
> > sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |   4 +
> > sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c      |  47 +++++
> > sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c    |  47 +++++
> > sysdeps/unix/sysv/linux/aarch64/ioctl.S            |  31 ----
> > sysdeps/unix/sysv/linux/aarch64/kernel-features.h  |  27 +++
> > sysdeps/unix/sysv/linux/aarch64/ldconfig.h         |   2 +
> > sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed    |   1 +
> > 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/setcontext.S       |   1 +
> > sysdeps/unix/sysv/linux/aarch64/shlib-versions     |   7 -
> > sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h   |   2 +-
> > sysdeps/unix/sysv/linux/aarch64/swapcontext.S      |   1 +
> > sysdeps/unix/sysv/linux/aarch64/sysdep.h           |   8 +-
> > sysdeps/unix/sysv/linux/arm/readelflib.c           |   4 +-
> > sysdeps/unix/sysv/linux/fallocate.c                |   4 +
> > sysdeps/unix/sysv/linux/fallocate64.c              |   4 +
> > sysdeps/unix/sysv/linux/generic/brk.c              |   2 +-
> > sysdeps/unix/sysv/linux/posix_fadvise.c            |   4 +
> > sysdeps/unix/sysv/linux/posix_fadvise64.c          |   4 +
> > sysdeps/unix/sysv/linux/posix_fallocate.c          |   4 +
> > sysdeps/unix/sysv/linux/posix_fallocate64.c        |   4 +
> > 100 files changed, 1649 insertions(+), 250 deletions(-)
> > delete mode 100644 sysdeps/aarch64/Implies
> > create mode 100644 sysdeps/aarch64/bits/wordsize.h
> > mode change 100644 => 100755 sysdeps/aarch64/configure
> > create mode 100644 sysdeps/aarch64/ilp32/Implies
> > create mode 100644 sysdeps/aarch64/lp64/Implies
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h
> > mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
> > 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/fstatfs.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.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/lseek.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.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/posix_fadvise.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.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/statfs.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
> > delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel-features.h
> > create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
> > 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
> >

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [RFC2 PATCH 00/23] ARM64: support ILP32
  2016-09-08 11:37   ` Yury Norov
@ 2016-09-08 11:51     ` Zhangjian (Bamvor)
  0 siblings, 0 replies; 59+ messages in thread
From: Zhangjian (Bamvor) @ 2016-09-08 11:51 UTC (permalink / raw)
  To: Yury Norov
  Cc: libc-alpha, linux-kernel, arnd, catalin.marinas,
	marcus.shawcroft, philb, davem, szabolcs.nagy, maxim.kuvyrkov,
	joseph, pinskia, schwab, fweimer, Prasun.Kapoor, cmetcalf,
	hjl.tools, adhemerval.zanella, Bamvor Zhang Jian, jijun (D),
	Hanjun Guo, Zhangjian (Bamvor)

Hi, Yury

On 2016/9/8 19:37, Yury Norov wrote:
> On Thu, Sep 08, 2016 at 12:25:27PM +0800, Zhangjian (Bamvor) wrote:
>> Hi, Guys
>>
>> There was a discussion about bump vdso version of kernel. We need
>> update the vdso version in glibc correspondingly otherwise the
>> application could not make use of the vdso.
>>
>> Is it make sense to you?
>>
>> Regards
>>
>> Bamvor
>
> Hi Bamvor,
>
> Is this the source of performance loss you've discovered?
Not yet.
There are mmmapstress03和vma03 failed in our kernel. I plan to
investigatet those bugs firstly. Do you encounter those failures?

Regards

Bamvor
>
>>
>> commit 3ffc1d798fc25ccb02e7cc325fe5fb3890c085e3
>> Author: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
>> Date:   Thu Sep 8 12:21:16 2016 +0800
>>
>>     [AARCH64] ILP32: bump vdso version consistent with kernel
>>
>>     Signed-off-by: Jun Ji <jijun2@huawei.com>
>>     Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
>>
>> diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c
>> index f7224a2..3e4eaad 100644
>> --- a/sysdeps/unix/sysv/linux/aarch64/init-first.c
>> +++ b/sysdeps/unix/sysv/linux/aarch64/init-first.c
>> @@ -27,17 +27,21 @@ int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
>>  static inline void
>>  _libc_vdso_platform_setup (void)
>>  {
>> -  PREPARE_VERSION (linux2639, "LINUX_2.6.39", 123718537);
>> +#ifndef __ILP32__
>> +  PREPARE_VERSION (linux, "LINUX_2.6.39", 123718537);
>> +#else
>> +  PREPARE_VERSION (linux, "LINUX_4.8", 61765624);
>> +#endif /* #ifndef __ILP32__ */
>>
>> -  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2639);
>> +  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux);
>>    PTR_MANGLE (p);
>>    VDSO_SYMBOL(gettimeofday) = p;
>>
>> -  p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2639);
>> +  p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux);
>>    PTR_MANGLE (p);
>>    VDSO_SYMBOL(clock_gettime) = p;
>>
>> -  p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2639);
>> +  p = _dl_vdso_vsym ("__kernel_clock_getres", &linux);
>>    PTR_MANGLE (p);
>>    VDSO_SYMBOL(clock_getres) = p;
>>  }
>>
>>
>> On 2016/6/29 0:39, Yury Norov wrote:
>>> This series enables aarch64 port with ilp32 mode.
>>>
>>> ABI details:
>>> - types are taken from AARCH32, next types turned to 64-bit,
>>>   as modern requirement for new APIs tells:
>>> 	ino_t      is  u64 type
>>> 	off_t      is  s64 type
>>> 	blkcnt_t   is  s64 type
>>> 	fsblkcnt_t is  u64 type
>>> 	fsfilcnt_t is  u64 type
>>> - 64-bit arguments are passed in syscall as register pair,
>>>   as kernel internally clears top halves for all input regs;
>>> - standard syscall table is used;
>>> - 32-bit time_t is used. AARCH64/ILP32 is waiting for general
>>>   fix of Y2038 problem just like other 32-bit arches;
>>> - stat{64}, statfs{64} structures are of the identical layout
>>>   with LP64. Corresponding syscalls are taken from 64-bit code
>>> - struct utmp, utmpx layouts are the same.
>>>
>>> v1: https://sourceware.org/ml/libc-alpha/2016-06/msg00730.html
>>> v2:
>>> - rebased on master;
>>> - dropped unneeded/unrelated patches;
>>> - pread family platform implementation removed;
>>> - addressed v1 comments (I'm really sorry if I missed something,
>>>   there are a lot of them, and I am really thankfull for detailed review);
>>>
>>> Tested with LTP. Regressions are like this:
>>> abort01                        FAIL       2
>>> kill11                         FAIL       2
>>> mmap16                         FAIL       6
>>> open12                         FAIL       2
>>> rename11                       FAIL       2
>>> rmdir02                        FAIL       2
>>> umount2_01                     FAIL       2
>>> umount2_02                     FAIL       2
>>> umount2_03                     FAIL       2
>>> utime06                        FAIL       2
>>>
>>> It's better than v1, and there are ~5 additional regressions comparing to
>>> aarch64, all are related to filesystem.
>>>
>>> Andrew Pinski (17):
>>>  [AARCH64] define word size for lp64 and ilp32
>>>  [AARCH64] Add header guards to sysdep.h headers.
>>>  Add dynamic ILP32 AARCH64 relocations to elf.h
>>>  [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in
>>>    LDST_PCREL and LDST_GLOBAL.
>>>  [AARCH64] Use PTR_REG in crti.S.
>>>  [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
>>>  [AARCH64] Use PTR_* macros in dl-trampoline.S
>>>  [AARCH64] Use PTR_* in start.S
>>>  [AARCH64] Use PTR_REG in getcontext.S.
>>>  [AARCH64] Detect ILP32 in configure scripts.
>>>  [AARCH64] Add ILP32 support to elf_machine_load_address.
>>>  [AARCH64] Add ILP32 to makefiles
>>>  [AARCH64] Add support to ldconfig for ILP32 and libilp32
>>>  [AARCH64] Add ILP32 ld.so to the known interpreter names.
>>>  [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
>>>  [AARCH64] Make lp64 and ilp32 directories.
>>>  [AARCH64] Fix ILP32 warning
>>>
>>> Yury Norov (6):
>>>  [AARCH64] ILP32: introduce syscalls that pass off_t
>>>  [AARCH64] ILP32: support stat syscall family
>>>  [AARCH64] delouse input arguments in system functions
>>>  [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32
>>>  off_t: fix register pair calculation for 64-bit case
>>>  [AARCH64] Take utmp{,x}.h from s390 port
>>>
>>> elf/cache.c                                        |   3 +
>>> sysdeps/aarch64/Implies                            |   6 -
>>> sysdeps/aarch64/__longjmp.S                        |   6 +-
>>> sysdeps/aarch64/bits/wordsize.h                    |  25 +++
>>> sysdeps/aarch64/configure                          |  15 +-
>>> sysdeps/aarch64/configure.ac                       |  11 +-
>>> sysdeps/aarch64/crti.S                             |   3 +-
>>> sysdeps/aarch64/dl-irel.h                          |   3 +-
>>> sysdeps/aarch64/dl-machine.h                       | 199 ++++++++++++---------
>>> sysdeps/aarch64/dl-tlsdesc.S                       |  56 +++---
>>> sysdeps/aarch64/dl-trampoline.S                    |  18 +-
>>> sysdeps/aarch64/ilp32/Implies                      |   6 +
>>> sysdeps/aarch64/jmpbuf-unwind.h                    |   2 +-
>>> sysdeps/aarch64/lp64/Implies                       |   7 +
>>> sysdeps/aarch64/memcmp.S                           |   3 +
>>> sysdeps/aarch64/memcpy.S                           |   8 +
>>> sysdeps/aarch64/memset.S                           |   3 +
>>> sysdeps/aarch64/nptl/bits/semaphore.h              |   4 +
>>> sysdeps/aarch64/preconfigure                       |  11 +-
>>> sysdeps/aarch64/setjmp.S                           |   5 +-
>>> sysdeps/aarch64/start.S                            |  20 ++-
>>> sysdeps/aarch64/strchr.S                           |   1 +
>>> sysdeps/aarch64/strchrnul.S                        |   1 +
>>> sysdeps/aarch64/strcmp.S                           |   2 +
>>> sysdeps/aarch64/strcpy.S                           |   2 +
>>> sysdeps/aarch64/strlen.S                           |   2 +
>>> sysdeps/aarch64/strncmp.S                          |   3 +
>>> sysdeps/aarch64/strnlen.S                          |   3 +
>>> sysdeps/aarch64/strrchr.S                          |   1 +
>>> sysdeps/aarch64/sysdep.h                           |  39 +++-
>>> sysdeps/generic/ldconfig.h                         |   1 +
>>> sysdeps/generic/stdint.h                           |   9 +-
>>> sysdeps/unix/sysv/linux/aarch64/Implies            |   2 -
>>> sysdeps/unix/sysv/linux/aarch64/Makefile           |  16 +-
>>> sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h       |   6 +-
>>> sysdeps/unix/sysv/linux/aarch64/bits/stat.h        | 195 ++++++++++++++++++++
>>> sysdeps/unix/sysv/linux/aarch64/bits/statfs.h      |  64 +++++++
>>> sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   |  86 +++++++++
>>> sysdeps/unix/sysv/linux/aarch64/bits/utmp.h        |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h       |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/clone.S            |   7 +
>>> sysdeps/unix/sysv/linux/aarch64/configure          |  24 ++-
>>> sysdeps/unix/sysv/linux/aarch64/configure.ac       |  11 +-
>>> sysdeps/unix/sysv/linux/aarch64/dl-cache.h         |  13 +-
>>> sysdeps/unix/sysv/linux/aarch64/getcontext.S       |   3 +-
>>> 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/fstatfs.c    |  29 +++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  29 +++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |   1 +
>>> .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c    |   4 +
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c     |  51 ++++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  44 +++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   |  77 ++++++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c      |  36 ++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c     |  47 +++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c   |  47 +++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c       |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c     |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c     |  32 ++++
>>> .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |   1 +
>>> .../sysv/linux/aarch64/ilp32/posix_fadvise64.c     |   2 +
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |   1 +
>>> 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 ++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c     |  30 ++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
>>> .../unix/sysv/linux/aarch64/ilp32/syscalls.list    |   0
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |   4 +
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c      |  47 +++++
>>> sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c    |  47 +++++
>>> sysdeps/unix/sysv/linux/aarch64/ioctl.S            |  31 ----
>>> sysdeps/unix/sysv/linux/aarch64/kernel-features.h  |  27 +++
>>> sysdeps/unix/sysv/linux/aarch64/ldconfig.h         |   2 +
>>> sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed    |   1 +
>>> 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/setcontext.S       |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/shlib-versions     |   7 -
>>> sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h   |   2 +-
>>> sysdeps/unix/sysv/linux/aarch64/swapcontext.S      |   1 +
>>> sysdeps/unix/sysv/linux/aarch64/sysdep.h           |   8 +-
>>> sysdeps/unix/sysv/linux/arm/readelflib.c           |   4 +-
>>> sysdeps/unix/sysv/linux/fallocate.c                |   4 +
>>> sysdeps/unix/sysv/linux/fallocate64.c              |   4 +
>>> sysdeps/unix/sysv/linux/generic/brk.c              |   2 +-
>>> sysdeps/unix/sysv/linux/posix_fadvise.c            |   4 +
>>> sysdeps/unix/sysv/linux/posix_fadvise64.c          |   4 +
>>> sysdeps/unix/sysv/linux/posix_fallocate.c          |   4 +
>>> sysdeps/unix/sysv/linux/posix_fallocate64.c        |   4 +
>>> 100 files changed, 1649 insertions(+), 250 deletions(-)
>>> delete mode 100644 sysdeps/aarch64/Implies
>>> create mode 100644 sysdeps/aarch64/bits/wordsize.h
>>> mode change 100644 => 100755 sysdeps/aarch64/configure
>>> create mode 100644 sysdeps/aarch64/ilp32/Implies
>>> create mode 100644 sysdeps/aarch64/lp64/Implies
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmp.h
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/utmpx.h
>>> mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
>>> 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/fstatfs.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.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/lseek.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.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/posix_fadvise.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.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/statfs.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
>>> delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel-features.h
>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
>>> 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
>>>

^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2016-09-08 11:59 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28 16:39 [RFC2 PATCH 00/23] ARM64: support ILP32 Yury Norov
2016-06-28 16:39 ` [PATCH 01/23] [AARCH64] define word size for lp64 and ilp32 Yury Norov
2016-06-28 17:00   ` Joseph Myers
2016-06-28 17:30     ` Joseph Myers
2016-06-28 16:39 ` [PATCH 02/23] [AARCH64] Add header guards to sysdep.h headers Yury Norov
2016-06-28 16:39 ` [PATCH 03/23] Add dynamic ILP32 AARCH64 relocations to elf.h Yury Norov
2016-06-28 17:03   ` Joseph Myers
2016-06-28 16:39 ` [PATCH 04/23] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Yury Norov
2016-06-28 16:39 ` [PATCH 05/23] [AARCH64] Use PTR_REG in crti.S Yury Norov
2016-06-28 17:05   ` Joseph Myers
2016-06-28 16:39 ` [PATCH 06/23] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Yury Norov
2016-06-28 17:06   ` Joseph Myers
2016-06-28 16:39 ` [PATCH 07/23] [AARCH64] Use PTR_* macros in dl-trampoline.S Yury Norov
2016-06-28 16:39 ` [PATCH 08/23] [AARCH64] Use PTR_* in start.S Yury Norov
2016-06-28 16:39 ` [PATCH 09/23] [AARCH64] Use PTR_REG in getcontext.S Yury Norov
2016-06-28 16:39 ` [PATCH 10/23] [AARCH64] Detect ILP32 in configure scripts Yury Norov
2016-06-28 17:07   ` Joseph Myers
2016-06-28 17:26     ` Yury Norov
2016-06-28 17:35       ` Joseph Myers
2016-06-28 16:39 ` [PATCH 11/23] [AARCH64] Add ILP32 support to elf_machine_load_address Yury Norov
2016-06-28 16:39 ` [PATCH 12/23] [AARCH64] Add ILP32 to makefiles Yury Norov
2016-06-28 16:39 ` [PATCH 13/23] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Yury Norov
2016-06-28 16:39 ` [PATCH 14/23] [AARCH64] Add ILP32 ld.so to the known interpreter names Yury Norov
2016-06-28 16:39 ` [PATCH 15/23] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Yury Norov
2016-06-28 16:39 ` [PATCH 16/23] [AARCH64] Make lp64 and ilp32 directories Yury Norov
2016-06-28 17:10   ` Joseph Myers
2016-06-29  8:43   ` Andreas Schwab
2016-06-28 16:39 ` [PATCH 17/23] [AARCH64] ILP32: introduce syscalls that pass off_t Yury Norov
2016-06-28 17:13   ` Joseph Myers
2016-06-29 10:10   ` Andreas Schwab
2016-06-29 12:04     ` Andreas Schwab
2016-06-28 16:39 ` [PATCH 18/23] [AARCH64] ILP32: support stat syscall family Yury Norov
2016-06-28 17:15   ` Joseph Myers
2016-06-28 19:08     ` Yury Norov
2016-06-28 20:41       ` Adhemerval Zanella
2016-06-28 20:46       ` Joseph Myers
2016-06-29  6:57   ` Andreas Schwab
2016-06-29  9:20   ` Andreas Schwab
2016-06-28 16:39 ` [PATCH 19/23] [AARCH64] delouse input arguments in system functions Yury Norov
2016-06-28 17:15   ` Joseph Myers
2016-06-29  7:49   ` Andreas Schwab
2016-06-28 16:39 ` [PATCH 20/23] [AARCH64] Fix ILP32 warning Yury Norov
2016-06-28 16:39 ` [PATCH 21/23] [AARCH64] Make __SIZEOF_SEM_T 16 for ILP32 Yury Norov
2016-06-28 17:16   ` Joseph Myers
2016-06-29  7:55   ` Andreas Schwab
2016-06-28 16:39 ` [PATCH 22/23] off_t: fix register pair calculation for 64-bit case Yury Norov
2016-06-28 17:17   ` Joseph Myers
2016-06-28 16:39 ` [PATCH 23/23] [AARCH64] Take utmp{,x}.h from s390 port Yury Norov
2016-06-28 17:18   ` Joseph Myers
2016-06-28 17:59     ` Yury Norov
2016-06-28 20:38       ` Joseph Myers
2016-06-28 20:43       ` Adhemerval Zanella
2016-06-28 16:57 ` [RFC2 PATCH 00/23] ARM64: support ILP32 Joseph Myers
2016-06-28 17:31 ` Adhemerval Zanella
2016-07-05  7:33 ` Andreas Schwab
2016-07-08 15:12 ` Yury Norov
2016-09-08  4:25 ` Zhangjian (Bamvor)
2016-09-08 11:37   ` Yury Norov
2016-09-08 11:51     ` Zhangjian (Bamvor)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).