diff mbox series

[v3,17/17] ARC: changes to enable 64-bit time_t, off_t, ino_t etc

Message ID 20200306182419.13945-18-vgupta@synopsys.com
State New
Headers show
Series glibc port to ARC processors | expand

Commit Message

Vineet Gupta March 6, 2020, 6:24 p.m. UTC
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 .../sysv/linux/arc/bits/socket-constants.h    |  4 +--
 sysdeps/unix/sysv/linux/arc/bits/timesize.h   | 21 +++++++++++++++
 sysdeps/unix/sysv/linux/arc/c++-types.data    | 16 ++++++------
 sysdeps/unix/sysv/linux/arc/configure         |  2 +-
 sysdeps/unix/sysv/linux/arc/configure.ac      |  2 +-
 sysdeps/unix/sysv/linux/arc/kernel_stat.h     | 26 +++++++++++++++++++
 sysdeps/unix/sysv/linux/arc/libc.abilist      |  6 ++---
 sysdeps/unix/sysv/linux/arc/sysdep.h          | 12 +++++++++
 8 files changed, 74 insertions(+), 15 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/arc/bits/timesize.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/kernel_stat.h

Comments

Joseph Myers March 7, 2020, 12:19 a.m. UTC | #1
On Fri, 6 Mar 2020, Vineet Gupta wrote:

> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> ---
>  .../sysv/linux/arc/bits/socket-constants.h    |  4 +--

There is a general principle for patch series: you should not have later 
patches fixing up things that were wrong with earlier patches.  Each patch 
should add files in the form desired to be reviewed, not in a form that 
gets fixed up later.

(Sometimes a patch series might change a file that was correct in an 
earlier patch in the series, as part of adding additional features, if the 
first M patches add feature X and the next N add feature Y on top of it.  
But that's not the case here - such later patches should not make 
incompatible changes to earlier ones.)
Vineet Gupta March 7, 2020, 12:37 a.m. UTC | #2
On 3/6/20 4:19 PM, Joseph Myers wrote:
> On Fri, 6 Mar 2020, Vineet Gupta wrote:
> 
>> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
>> ---
>>  .../sysv/linux/arc/bits/socket-constants.h    |  4 +--
> 
> There is a general principle for patch series: you should not have later 
> patches fixing up things that were wrong with earlier patches.  Each patch 
> should add files in the form desired to be reviewed, not in a form that 
> gets fixed up later.
> 
> (Sometimes a patch series might change a file that was correct in an 
> earlier patch in the series, as part of adding additional features, if the 
> first M patches add feature X and the next N add feature Y on top of it.  
> But that's not the case here - such later patches should not make 
> incompatible changes to earlier ones.)

I agree and you've mentioned this fact before as well. The only reason I carved it
this way was to ease my testing. The 64-bit time code was based on RV32 which in
turn was based on bleeding edge upstream some of which needed additional work for
ARC but ininitial days of 64-bit work, it was hard to know if the fix was needed
for 64-bit or for upstream tracking. And that's exactly what I got bitten by -
when I missed the fixup for init constructor invocation from Florian, wasting 3
days [1]

Anyhow that's just to give you the context. I can split them up and add to
respective sections for next iteration. If we end up not doing another iteration
- hypothetically speaking :-) the whole port is anyhow committed as 1 patch so it
doesn't matter.

[1] http://lists.infradead.org/pipermail/linux-snps-arc/2020-February/006974.html
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/arc/bits/socket-constants.h b/sysdeps/unix/sysv/linux/arc/bits/socket-constants.h
index 053b5cee399a..74b0c06edb36 100644
--- a/sysdeps/unix/sysv/linux/arc/bits/socket-constants.h
+++ b/sysdeps/unix/sysv/linux/arc/bits/socket-constants.h
@@ -30,9 +30,9 @@ 
 #define SO_OOBINLINE 10
 #define SO_RCVBUF 8
 #define SO_RCVLOWAT 18
-#define SO_RCVTIMEO 20
+#define SO_RCVTIMEO 66
 #define SO_REUSEADDR 2
 #define SO_SNDBUF 7
 #define SO_SNDLOWAT 19
-# define SO_SNDTIMEO 21
+# define SO_SNDTIMEO 67
 #define SO_TYPE 3
diff --git a/sysdeps/unix/sysv/linux/arc/bits/timesize.h b/sysdeps/unix/sysv/linux/arc/bits/timesize.h
new file mode 100644
index 000000000000..1259077c6412
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arc/bits/timesize.h
@@ -0,0 +1,21 @@ 
+/* Bit size of the time_t type at glibc build time, general case.
+   Copyright (C) 2019-2020 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 <bits/wordsize.h>
+
+#define __TIMESIZE	64
diff --git a/sysdeps/unix/sysv/linux/arc/c++-types.data b/sysdeps/unix/sysv/linux/arc/c++-types.data
index 303f4570c8ee..0fb0143ae746 100644
--- a/sysdeps/unix/sysv/linux/arc/c++-types.data
+++ b/sysdeps/unix/sysv/linux/arc/c++-types.data
@@ -1,5 +1,5 @@ 
 blkcnt64_t:x
-blkcnt_t:l
+blkcnt_t:x
 blksize_t:i
 caddr_t:Pc
 clockid_t:i
@@ -8,14 +8,14 @@  daddr_t:i
 dev_t:y
 fd_mask:l
 fsblkcnt64_t:y
-fsblkcnt_t:m
+fsblkcnt_t:y
 fsfilcnt64_t:y
-fsfilcnt_t:m
+fsfilcnt_t:y
 fsid_t:8__fsid_t
 gid_t:j
 id_t:j
 ino64_t:y
-ino_t:m
+ino_t:y
 int16_t:s
 int32_t:i
 int64_t:x
@@ -26,7 +26,7 @@  loff_t:x
 mode_t:j
 nlink_t:j
 off64_t:x
-off_t:l
+off_t:x
 pid_t:i
 pthread_attr_t:14pthread_attr_t
 pthread_barrier_t:17pthread_barrier_t
@@ -44,13 +44,13 @@  pthread_t:m
 quad_t:x
 register_t:i
 rlim64_t:y
-rlim_t:m
+rlim_t:y
 sigset_t:10__sigset_t
 size_t:j
 socklen_t:j
 ssize_t:i
-suseconds_t:l
-time_t:l
+suseconds_t:x
+time_t:x
 u_char:h
 uid_t:j
 uint:j
diff --git a/sysdeps/unix/sysv/linux/arc/configure b/sysdeps/unix/sysv/linux/arc/configure
index f74fa7cb0259..56ec14357507 100644
--- a/sysdeps/unix/sysv/linux/arc/configure
+++ b/sysdeps/unix/sysv/linux/arc/configure
@@ -1,4 +1,4 @@ 
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/unix/sysv/linux/arc.
 
-arch_minimum_kernel=3.9.0
+arch_minimum_kernel=5.1.0
diff --git a/sysdeps/unix/sysv/linux/arc/configure.ac b/sysdeps/unix/sysv/linux/arc/configure.ac
index a9528032d32a..8af5a12cc248 100644
--- a/sysdeps/unix/sysv/linux/arc/configure.ac
+++ b/sysdeps/unix/sysv/linux/arc/configure.ac
@@ -1,4 +1,4 @@ 
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/unix/sysv/linux/arc.
 
-arch_minimum_kernel=3.9.0
+arch_minimum_kernel=5.1.0
diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h b/sysdeps/unix/sysv/linux/arc/kernel_stat.h
new file mode 100644
index 000000000000..8fdd86b9e843
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arc/kernel_stat.h
@@ -0,0 +1,26 @@ 
+/* Copyright (C) 2020 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
+   <https://www.gnu.org/licenses/>.  */
+
+#include <bits/wordsize.h>
+
+/* Needed to elide the itemized copy code in common xstatconv.c.  */
+#define STAT_IS_KERNEL_STAT 1
+
+/* Nice side-effect of 64-bit time_t switch is these are same.  */
+#define XSTAT_IS_XSTAT64 1
+
+#define STATFS_IS_STATFS64 0
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index a95b31434496..1e554c5be072 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -1,7 +1,7 @@ 
 GLIBC_2.32 _Exit F
-GLIBC_2.32 _IO_2_1_stderr_ D 0x98
-GLIBC_2.32 _IO_2_1_stdin_ D 0x98
-GLIBC_2.32 _IO_2_1_stdout_ D 0x98
+GLIBC_2.32 _IO_2_1_stderr_ D 0x9c
+GLIBC_2.32 _IO_2_1_stdin_ D 0x9c
+GLIBC_2.32 _IO_2_1_stdout_ D 0x9c
 GLIBC_2.32 _IO_adjust_column F
 GLIBC_2.32 _IO_adjust_wcolumn F
 GLIBC_2.32 _IO_default_doallocate F
diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
index 77d815e882e5..9cd12a86a950 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -22,6 +22,18 @@ 
 #include <sysdeps/arc/sysdep.h>
 #include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
+/* ARC's version of asm-generic syscall ABI does provide fstat64 and fstatat64
+   but it not compatible with glibc 64-bit time_t based stat64. So undef them
+   to allow generic code to pick up statx syscall based wrappers which do the
+   explict interworking.
+   Similarly futex32 exists and works but we'd rather use futex64. But lll code
+   using futex expects __NR_futex hence the forced redefine
+   */
+#undef __NR_fstat64
+#undef __NR_fstatat64
+#undef __NR_futex
+#define __NR_futex __NR_futex_time64
+
 /* For RTLD_PRIVATE_ERRNO.  */
 #include <dl-sysdep.h>