Re: [RFC PATCH 00/27] ARM64: support ILP32

From: Zhangjian (Bamvor)
Date: Tue Jun 21 2016 - 08:08:18 EST


Hi,


In our test, we need to fix stack pointer in makecontext. Not sure
if it should be a standalone patch:

From 1d51ca34034ef83ea602874a93e26fd158ddd214 Mon Sep 17 00:00:00 2001
From: Jun Ji <jijun2@xxxxxxxxxx>
Date: Fri, 29 Apr 2016 17:20:23 +0800
Subject: [PATCH] fix for makecontext error

Signed-off-by: Jun Ji <jijun2@xxxxxxxxxx>

---
sysdeps/unix/sysv/linux/aarch64/makecontext.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/aarch64/makecontext.c b/sysdeps/unix/sysv/linux/aarch64/makecontext.c
index 34f91a3..55a26a3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/aarch64/makecontext.c
@@ -42,18 +42,18 @@ void
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
{
extern void __startcontext (void);
- unsigned long int *sp;
+ unsigned long long *sp;
va_list ap;
int i;

- sp = (unsigned long int *)
+ sp = (unsigned long long *)
((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);

/* Allocate stack arguments. */
sp -= argc < 8 ? 0 : argc - 8;

/* Keep the stack aligned. */
- sp = (unsigned long int *) (((uintptr_t) sp) & -16L);
+ sp = (unsigned long long *) (((uintptr_t) sp) & -16L);

ucp->uc_mcontext.regs[19] = (uintptr_t) ucp->uc_link;
ucp->uc_mcontext.sp = (uintptr_t) sp;
@@ -64,9 +64,9 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
va_start (ap, argc);
for (i = 0; i < argc; ++i)
if (i < 8)
- ucp->uc_mcontext.regs[i] = va_arg (ap, unsigned long int);
+ ucp->uc_mcontext.regs[i] = va_arg (ap, unsigned long long);
else
- sp[i - 8] = va_arg (ap, unsigned long int);
+ sp[i - 8] = va_arg (ap, unsigned long long);

va_end (ap);
}
--
1.8.4.5

Regards

Bamvor

On 2016/6/21 13:06, Yury Norov wrote:
This series enables aarch64 port with ilp32 mode.

After long discussions in kernel list, we finally got
consensus on how ABI should look. This patchset adds
support for the ABI in GLIBC. It is tested with LTP
with no big regressions comparing to LP64 and AARCH32.

Though it's very raw. Please be patient reviewing it.

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.

Links:
This series: https://github.com/norov/glibc/commits/ilp32-2.23
Kernel series: https://github.com/norov/linux/commits/ilp32-nowrap
Kernel in LKML: https://lkml.org/lkml/2016/6/17/990

Please review it. Any comments appreciated.

Yury.

Andrew Pinski (24):
[AARCH64] Fix utmp struct for compatibility reasons.
[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] Syscalls for ILP32 are passed always via 64bit values.
[AARCH64] Add ILP32 support to elf_machine_load_address.
[AARCH64] Set up wordsize for ILP32.
[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] Add kernel_sigaction.h for AARCH64 ILP32
[AARCH64] Add typesizes.h for ILP32
[AARCH64] Make lp64 and ilp32 directories.
Add support for AT_ARM64_MIDR.
[AARCH64] Fix ILP32 warning
[AARCH64] Change type of __align to long long
Fix PTRDIFF_MIN/PTRDIFF_MIN and PTRDIFF_MIN for ILP32.

Yury Norov (3):
[AARCH64] ILP32: introduce syscalls that pass off_t
[AARCH64] ILP32: support stat syscall family
[AARCH64] delouse input arguments in system functions

elf/cache.c | 2 +
elf/dl-sysdep.c | 1 +
elf/elf.h | 3 +
sysdeps/aarch64/Implies | 6 -
sysdeps/aarch64/__longjmp.S | 6 +-
sysdeps/aarch64/bits/wordsize.h | 28 +++
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 | 42 +++--
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 | 4 +-
sysdeps/aarch64/memmove.S | 3 +
sysdeps/aarch64/memset.S | 3 +-
sysdeps/aarch64/nptl/bits/semaphore.h | 2 +-
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 | 72 ++++++++
sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h | 91 ++++++++++
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-auxv.h | 25 +++
sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 +-
sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c | 5 +
sysdeps/unix/sysv/linux/aarch64/getcontext.S | 3 +-
sysdeps/unix/sysv/linux/aarch64/ilp32/Implies | 4 +
.../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c | 6 +
sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c | 6 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c | 31 ++++
.../unix/sysv/linux/aarch64/ilp32/fallocate64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c | 29 +++
sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c | 72 ++++++++
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 | 54 ++++++
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 | 78 ++++++++
sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c | 36 ++++
sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c | 0
sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.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/pread.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c | 5 +
sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c | 5 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c | 5 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c | 1 +
sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c | 5 +
sysdeps/unix/sysv/linux/aarch64/ilp32/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_sigaction.h | 12 ++
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/sigaction.c | 10 +-
sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h | 2 +-
sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 1 +
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 56 +++---
sysdeps/unix/sysv/linux/arm/readelflib.c | 4 +-
sysdeps/unix/sysv/linux/generic/brk.c | 2 +-
sysdeps/unix/sysv/linux/sysdep-vdso.h | 4 +-
110 files changed, 1744 insertions(+), 271 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
mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c
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/fallocate.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.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/llseek.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.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/pread.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/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_sigaction.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