Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-27 Thread Arnd Bergmann
On Monday, June 27, 2016 9:56:13 AM CEST Andreas Schwab wrote:
> Yury Norov  writes:
> 
> > 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 010
> >  #define __O_DIRECT   020
> >  
> > -#define __O_LARGEFILE0
> > +#ifdef __ILP32__
> > +# define __O_LARGEFILE   040
> > +#else
> > +# define __O_LARGEFILE   0
> > +#endif
> 
> Is there any point in defining O_LARGEFILE to non-zero if the kernel is
> enforcing it anyway?

The kernel might want to return -EINVAL for undefined flags. I'm not
sure if we want to do that here, but it would seem like a correct
return code.

Arnd


Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-27 Thread Arnd Bergmann
On Monday, June 27, 2016 9:56:13 AM CEST Andreas Schwab wrote:
> Yury Norov  writes:
> 
> > 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 010
> >  #define __O_DIRECT   020
> >  
> > -#define __O_LARGEFILE0
> > +#ifdef __ILP32__
> > +# define __O_LARGEFILE   040
> > +#else
> > +# define __O_LARGEFILE   0
> > +#endif
> 
> Is there any point in defining O_LARGEFILE to non-zero if the kernel is
> enforcing it anyway?

The kernel might want to return -EINVAL for undefined flags. I'm not
sure if we want to do that here, but it would seem like a correct
return code.

Arnd


Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-27 Thread Andreas Schwab
Yury Norov  writes:

> 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 010
>  #define __O_DIRECT   020
>  
> -#define __O_LARGEFILE0
> +#ifdef __ILP32__
> +# define __O_LARGEFILE   040
> +#else
> +# define __O_LARGEFILE   0
> +#endif

Is there any point in defining O_LARGEFILE to non-zero if the kernel is
enforcing it anyway?

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-27 Thread Andreas Schwab
Yury Norov  writes:

> 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 010
>  #define __O_DIRECT   020
>  
> -#define __O_LARGEFILE0
> +#ifdef __ILP32__
> +# define __O_LARGEFILE   040
> +#else
> +# define __O_LARGEFILE   0
> +#endif

Is there any point in defining O_LARGEFILE to non-zero if the kernel is
enforcing it anyway?

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-21 Thread Joseph Myers
On Tue, 21 Jun 2016, Yury Norov wrote:

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

My previous comments at 
 apply.  Where 
are your ABI test baselines?

> diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies
> new file mode 100644
> index 000..705bc5b
> --- /dev/null
> +++ b/sysdeps/aarch64/ilp32/Implies
> @@ -0,0 +1,6 @@
> +aarch64
> +wordsize-32
> +ieee754/ldbl-128
> +ieee754/dbl-64
> +ieee754/flt-32
> +aarch64/soft-fp

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

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

The formatting in this file is thoroughly wrong.

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c 
> b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
> new file mode 100644
> index 000..b5b9994
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
> @@ -0,0 +1 @@
> +/* See preadv.c */
> \ No newline at end of file

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

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions 
> b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
> new file mode 100644
> index 000..17db764
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
> @@ -0,0 +1,7 @@
> +DEFAULT  GLIBC_2.21

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

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-21 Thread Joseph Myers
On Tue, 21 Jun 2016, Yury Norov wrote:

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

My previous comments at 
 apply.  Where 
are your ABI test baselines?

> diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies
> new file mode 100644
> index 000..705bc5b
> --- /dev/null
> +++ b/sysdeps/aarch64/ilp32/Implies
> @@ -0,0 +1,6 @@
> +aarch64
> +wordsize-32
> +ieee754/ldbl-128
> +ieee754/dbl-64
> +ieee754/flt-32
> +aarch64/soft-fp

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

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

The formatting in this file is thoroughly wrong.

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c 
> b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
> new file mode 100644
> index 000..b5b9994
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
> @@ -0,0 +1 @@
> +/* See preadv.c */
> \ No newline at end of file

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

> diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions 
> b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
> new file mode 100644
> index 000..17db764
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
> @@ -0,0 +1,7 @@
> +DEFAULT  GLIBC_2.21

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

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-21 Thread Andreas Schwab
Yury Norov  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 000..0f89a09
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
> @@ -0,0 +1,78 @@
> +/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   .  */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +struct kernel_dirent64
> +  {
> +uint64_t d_ino;
> +int64_t  d_off;
> +unsigned short int   d_reclen;
> +unsigned chard_type;
> +char d_name[256];
> +  };
> +
> +static size_t conv (char *buf, size_t nbytes)
> +{
> + char *end = buf + nbytes;
> + struct dirent *u = (struct dirent *) buf;
> + struct kernel_dirent64 *k = (struct kernel_dirent64 *) buf;
> + size_t sizd = offsetof(struct kernel_dirent64, d_name)
> +   - offsetof(struct dirent, d_name);
> +
> + while ((char*) k < end)
> + {
> +   struct kernel_dirent64 *nk = (char *) k + k->d_reclen;
> +   size_t name_len = k->d_reclen - offsetof(struct kernel_dirent64, 
> d_name);
> +
> +   u->d_ino = k->d_ino;
> +   u->d_off = k->d_off;
> +   u->d_reclen = k->d_reclen - sizd;
> +   u->d_type = k->d_type;
> +   memcpy (u->d_name, k->d_name, name_len);
> +
> +   u = (char *) u + u->d_reclen;
> +   k = nk;
> + }
> +
> + return (size_t) u - (size_t) buf;
> +}
> +
> +ssize_t
> +__getdents (int fd, char *buf, size_t nbytes)
> +{
> +
> +  struct kernel_dirent64 *k;

Unused variable.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-21 Thread Andreas Schwab
Yury Norov  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 000..0f89a09
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
> @@ -0,0 +1,78 @@
> +/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   .  */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +struct kernel_dirent64
> +  {
> +uint64_t d_ino;
> +int64_t  d_off;
> +unsigned short int   d_reclen;
> +unsigned chard_type;
> +char d_name[256];
> +  };
> +
> +static size_t conv (char *buf, size_t nbytes)
> +{
> + char *end = buf + nbytes;
> + struct dirent *u = (struct dirent *) buf;
> + struct kernel_dirent64 *k = (struct kernel_dirent64 *) buf;
> + size_t sizd = offsetof(struct kernel_dirent64, d_name)
> +   - offsetof(struct dirent, d_name);
> +
> + while ((char*) k < end)
> + {
> +   struct kernel_dirent64 *nk = (char *) k + k->d_reclen;
> +   size_t name_len = k->d_reclen - offsetof(struct kernel_dirent64, 
> d_name);
> +
> +   u->d_ino = k->d_ino;
> +   u->d_off = k->d_off;
> +   u->d_reclen = k->d_reclen - sizd;
> +   u->d_type = k->d_type;
> +   memcpy (u->d_name, k->d_name, name_len);
> +
> +   u = (char *) u + u->d_reclen;
> +   k = nk;
> + }
> +
> + return (size_t) u - (size_t) buf;
> +}
> +
> +ssize_t
> +__getdents (int fd, char *buf, size_t nbytes)
> +{
> +
> +  struct kernel_dirent64 *k;

Unused variable.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."