Skip to contentSkip to conversation

RISC-V: Use 64-bit time_t and off_t for RV32 and RV64

RFC Vineet Gupta 13 participants 62 messages Feb 12, 2020 – Aug 21, 2021 2 messages not in the archive Synopsys ARC architecture

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 4e95f95966d8d7c6a8339160dc62d81c1f6a1bfb.1578824547.git.alistair.francis@wdc.com

#2 lore raw

Hi Alistair,

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 195 lines · Alistair Francis

Using the original glibc headers under bits/ let's make small modifications to use 64-bit time_t and off_t for both RV32 and RV64.

For the typesizes.h, here are justifications for the changes from the generic version (based on Arnd's very helpful feedback):

(quoted diff) +0 -4
-  All the !__USE_FILE_OFFSET64  types (__off_t, __ino_t, __rlim_t, ...) are
  changed to match the 64-bit replacements.
 
- __time_t is defined to 64 bit, but no __time64_t is added. This makes sense
  as we don't have the time64 support for other 32-bit architectures yet, and
  it will be easy to change when that happens.
 
- __suseconds_t is 64-bit. This matches what we use the kerne ABI for the
  few drivers that are relying on 'struct timeval' input arguments in
  ioctl, as well as the adjtimex system call. It means that timeval has to
  be defined without the   padding, unlike timespec, which needs padding.
---
 .../unix/sysv/linux/riscv/bits/environments.h | 85 ++++++++++++++++++
 sysdeps/unix/sysv/linux/riscv/bits/time64.h   | 36 ++++++++
 sysdeps/unix/sysv/linux/riscv/bits/timesize.h | 22 +++++
 .../unix/sysv/linux/riscv/bits/typesizes.h    | 90 +++++++++++++++++++
 sysdeps/unix/sysv/linux/riscv/kernel_stat.h   | 23 +++++
 5 files changed, 256 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/environments.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/time64.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/timesize.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/kernel_stat.h
sysdeps/unix/sysv/linux/riscv/bits/environments.h new file +85 -0
new file mode 100644
index 0000000000..8d401d1976
@@ -0,0 +1,85 @@
+/* Copyright (C) 1999-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/>.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V7_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V7_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V7_LP64_OFF32	   64bit long and pointers and 32bit off_t type
+   _POSIX_V7_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG,
+   _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32,
+   _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were
+   used in previous versions of the Unix standard and are available
+   only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* We can never provide environments with 32-bit wide pointers.  */
+# define _POSIX_V7_ILP32_OFF32	-1
+# define _POSIX_V7_ILP32_OFFBIG	-1
+# define _POSIX_V6_ILP32_OFF32	-1
+# define _POSIX_V6_ILP32_OFFBIG	-1
+# define _XBS5_ILP32_OFF32	-1
+# define _XBS5_ILP32_OFFBIG	-1
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V7_LPBIG_OFFBIG	-1
+# define _POSIX_V6_LPBIG_OFFBIG	-1
+# define _XBS5_LPBIG_OFFBIG	-1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V7_LP64_OFF64	1
+# define _POSIX_V6_LP64_OFF64	1
+# define _XBS5_LP64_OFF64	1
+
+#else /* __WORDSIZE == 32 */
+
+/* RISC-V requires 64-bit off_t
+  # undef _POSIX_V7_ILP32_OFF32
+  # undef _POSIX_V6_ILP32_OFF32
+  # undef _XBS5_ILP32_OFF32
+ */
+
+# define _POSIX_V7_ILP32_OFFBIG  1
+# define _POSIX_V6_ILP32_OFFBIG  1
+# define _XBS5_ILP32_OFFBIG   1
+
+/* We can never provide environments with 64-bit wide pointers.  */
+# define _POSIX_V7_LP64_OFF64	-1
+# define _POSIX_V7_LPBIG_OFFBIG	-1
+# define _POSIX_V6_LP64_OFF64	-1
+# define _POSIX_V6_LPBIG_OFFBIG	-1
+# define _XBS5_LP64_OFF64	-1
+# define _XBS5_LPBIG_OFFBIG	-1
+
+/* CFLAGS.  */
+#define __ILP32_OFFBIG_CFLAGS   "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
+#endif /* __WORDSIZE == 32 */
sysdeps/unix/sysv/linux/riscv/bits/time64.h new file +36 -0
new file mode 100644
index 0000000000..cc21b45ef1
@@ -0,0 +1,36 @@
+/* bits/time64.h -- underlying types for __time64_t.  Generic version.
+   Copyright (C) 2018-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/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/time64.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TIME64_H
+#define	_BITS_TIME64_H	1
+
+/* Define __TIME64_T_TYPE so that it is always a 64-bit type.  */
+
+#if __WORDSIZE == 64
+/* If we already have 64-bit time type then use it.  */
+# define __TIME64_T_TYPE		__TIME_T_TYPE
+#else
+/* Define a 64-bit time type alongsize the 32-bit one.  */
+# define __TIME64_T_TYPE		__SQUAD_TYPE
+#endif
+
+#endif /* bits/time64.h */
sysdeps/unix/sysv/linux/riscv/bits/timesize.h new file +22 -0
new file mode 100644
index 0000000000..afb5d86b2b
@@ -0,0 +1,22 @@
+/* Bit size of the time_t type at glibc build time, general case.
+   Copyright (C) 2018-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>
+
+/* RV32 and RV64 both use 64-bit time_t */
+#define __TIMESIZE	64
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +0 -0
new file mode 100644
index 0000000000..0da3bdeb5d

I was hoping newer arches could simply use the asm-generic one ?

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 4 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +4 -0
+/* 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

This is orthogonal to time_t but since we are on topic of newer ports, how are you doing this. The asm-generic uapi defines

	typedef __kernel_long_t	__kernel_off_t;

and types.h defines

	typedef __kernel_off_t off_t;

And I presume long on RV32 is 32-bits

Quoted 9 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +6 -0
+
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T 1
 
 
 
+
+/* And for rlim_t and rlim64_t.  */
+# define __RLIM_T_MATCHES_RLIM64_T  1

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 10 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +10 -0
+
+/* And for fsblkcnt_t and fsfilcnt_t */
+# define __STATFS_MATCHES_STATFS64 1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
+
+/* Define these as RV32 requires 64-bit syscall. */
+#if __riscv_xlen == 32
+#define __ASSUME_TIME64_SYSCALLS 1

From the POV of newer arches needing 64-bit time_t support, this need not be forced as it is set automatically for kernel >= 5.1

Quoted 1 line

+#define __ASSUME_RLIM64_SYSCALLS 1

Is this used anywhere ?

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#3 lore raw
Quoted 2 lines · Vineet Gupta

Hi Alistair,

Hi Vineet,

Quoted 191 lines · Alistair Francis
Quoted 189 lines

Using the original glibc headers under bits/ let's make small modifications to use 64-bit time_t and off_t for both RV32 and RV64.

For the typesizes.h, here are justifications for the changes from the generic version (based on Arnd's very helpful feedback):

(quoted diff) +0 -4
-  All the !__USE_FILE_OFFSET64  types (__off_t, __ino_t, __rlim_t, ...) are
  changed to match the 64-bit replacements.
 
- __time_t is defined to 64 bit, but no __time64_t is added. This makes sense
  as we don't have the time64 support for other 32-bit architectures yet, and
  it will be easy to change when that happens.
 
- __suseconds_t is 64-bit. This matches what we use the kerne ABI for the
  few drivers that are relying on 'struct timeval' input arguments in
  ioctl, as well as the adjtimex system call. It means that timeval has to
  be defined without the   padding, unlike timespec, which needs padding.
---
 .../unix/sysv/linux/riscv/bits/environments.h | 85 ++++++++++++++++++
 sysdeps/unix/sysv/linux/riscv/bits/time64.h   | 36 ++++++++
 sysdeps/unix/sysv/linux/riscv/bits/timesize.h | 22 +++++
 .../unix/sysv/linux/riscv/bits/typesizes.h    | 90 +++++++++++++++++++
 sysdeps/unix/sysv/linux/riscv/kernel_stat.h   | 23 +++++
 5 files changed, 256 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/environments.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/time64.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/timesize.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/kernel_stat.h
sysdeps/unix/sysv/linux/riscv/bits/environments.h new file +85 -0
new file mode 100644
index 0000000000..8d401d1976
@@ -0,0 +1,85 @@
+/* Copyright (C) 1999-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/>.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V7_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V7_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V7_LP64_OFF32         64bit long and pointers and 32bit off_t type
+   _POSIX_V7_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG,
+   _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32,
+   _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were
+   used in previous versions of the Unix standard and are available
+   only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* We can never provide environments with 32-bit wide pointers.  */
+# define _POSIX_V7_ILP32_OFF32       -1
+# define _POSIX_V7_ILP32_OFFBIG      -1
+# define _POSIX_V6_ILP32_OFF32       -1
+# define _POSIX_V6_ILP32_OFFBIG      -1
+# define _XBS5_ILP32_OFF32   -1
+# define _XBS5_ILP32_OFFBIG  -1
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V7_LPBIG_OFFBIG      -1
+# define _POSIX_V6_LPBIG_OFFBIG      -1
+# define _XBS5_LPBIG_OFFBIG  -1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V7_LP64_OFF64        1
+# define _POSIX_V6_LP64_OFF64        1
+# define _XBS5_LP64_OFF64    1
+
+#else /* __WORDSIZE == 32 */
+
+/* RISC-V requires 64-bit off_t
+  # undef _POSIX_V7_ILP32_OFF32
+  # undef _POSIX_V6_ILP32_OFF32
+  # undef _XBS5_ILP32_OFF32
+ */
+
+# define _POSIX_V7_ILP32_OFFBIG  1
+# define _POSIX_V6_ILP32_OFFBIG  1
+# define _XBS5_ILP32_OFFBIG   1
+
+/* We can never provide environments with 64-bit wide pointers.  */
+# define _POSIX_V7_LP64_OFF64        -1
+# define _POSIX_V7_LPBIG_OFFBIG      -1
+# define _POSIX_V6_LP64_OFF64        -1
+# define _POSIX_V6_LPBIG_OFFBIG      -1
+# define _XBS5_LP64_OFF64    -1
+# define _XBS5_LPBIG_OFFBIG  -1
+
+/* CFLAGS.  */
+#define __ILP32_OFFBIG_CFLAGS   "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
+#endif /* __WORDSIZE == 32 */
sysdeps/unix/sysv/linux/riscv/bits/time64.h new file +36 -0
new file mode 100644
index 0000000000..cc21b45ef1
@@ -0,0 +1,36 @@
+/* bits/time64.h -- underlying types for __time64_t.  Generic version.
+   Copyright (C) 2018-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/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/time64.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef      _BITS_TIME64_H
+#define      _BITS_TIME64_H  1
+
+/* Define __TIME64_T_TYPE so that it is always a 64-bit type.  */
+
+#if __WORDSIZE == 64
+/* If we already have 64-bit time type then use it.  */
+# define __TIME64_T_TYPE             __TIME_T_TYPE
+#else
+/* Define a 64-bit time type alongsize the 32-bit one.  */
+# define __TIME64_T_TYPE             __SQUAD_TYPE
+#endif
+
+#endif /* bits/time64.h */
sysdeps/unix/sysv/linux/riscv/bits/timesize.h new file +21 -0
new file mode 100644
index 0000000000..afb5d86b2b
@@ -0,0 +1,22 @@
+/* Bit size of the time_t type at glibc build time, general case.
+   Copyright (C) 2018-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>
+
+/* RV32 and RV64 both use 64-bit time_t */
Quoted 8 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 6 lines
sysdeps/unix/sysv/linux/riscv/bits/timesize.h new file +1 -0
+#define __TIMESIZE   64
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +0 -0
new file mode 100644
index 0000000000..0da3bdeb5d

I was hoping newer arches could simply use the asm-generic one ?

We need to specify that RV32 uses a 64-bit time_t. The generic ones don't do that for 32-bit arches.

Quoted 9 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 5 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +4 -0
+/* 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

This is orthogonal to time_t but since we are on topic of newer ports, how are you doing this. The asm-generic uapi defines

Quoted 7 lines
        typedef __kernel_long_t __kernel_off_t;

and types.h defines

        typedef __kernel_off_t off_t;

And I presume long on RV32 is 32-bits

Can you point me to the code? Last time I looked the kernel used the 64-bit versions for the syscalls on RV32.

Quoted 7 lines
Quoted 4 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +3 -0
+
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T 1
Quoted 16 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 13 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +13 -0
+
+/* And for rlim_t and rlim64_t.  */
+# define __RLIM_T_MATCHES_RLIM64_T  1
+
+/* And for fsblkcnt_t and fsfilcnt_t */
+# define __STATFS_MATCHES_STATFS64 1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
+
+/* Define these as RV32 requires 64-bit syscall. */
+#if __riscv_xlen == 32
+#define __ASSUME_TIME64_SYSCALLS 1

From the POV of newer arches needing 64-bit time_t support, this need not be forced as it is set automatically for kernel >= 5.1

Ah, I think you are right about this and we don't need to define it.

Quoted 4 lines
Quoted 2 lines

+#define __ASSUME_RLIM64_SYSCALLS 1

Is this used anywhere ?

Apparently not, I have removed it.

Alistair

Quoted 3 lines

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#4 lore raw
Quoted 10 lines · Alistair Francis
Quoted 7 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 5 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +0 -0
new file mode 100644
index 0000000000..0da3bdeb5d

I was hoping newer arches could simply use the asm-generic one ?

We need to specify that RV32 uses a 64-bit time_t. The generic ones don't do that for 32-bit arches.

Since it seems we'd like future 32-bit ports of glibc to use 64-bit time and offsets, we should make that as easy as possible.

That is, you need an RISC-V-specific bits/timesize.h. But you shouldn't need an RISC-V-specific bits/typesizes.h - rather, make the linux/generic one do the right thing for __TIME_T_TYPE based on bits/timesize.h. And have some other header that 32-bit linux/generic ports can use to say whether they use the 64-bit offset/stat/statfs interface, that bits/typesizes.h can use together with its existing __LP64__ check, and make the definitions of __OFF_T_TYPE etc. check that as well, and then you shouldn't need an RISC-V-specific bits/typesizes.h - the RISC-V-specific headers should be strictly minimal. (No architecture-specific bits/time64.h headers should be needed in any case.)

At some point (or indeed now) we might flip the default for linux/generic so the architectures needing an architecture-specific header are only the older 32-bit linux/generic architectures that have support for 32-bit times and offsets, and the newer ones with no such support don't need such a header.

Signature · 7 lines
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#5 lore raw
Quoted 17 lines · Joseph Myers
Quoted 10 lines · Alistair Francis
Quoted 7 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 5 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +0 -0
new file mode 100644
index 0000000000..0da3bdeb5d

I was hoping newer arches could simply use the asm-generic one ?

We need to specify that RV32 uses a 64-bit time_t. The generic ones don't do that for 32-bit arches.

Since it seems we'd like future 32-bit ports of glibc to use 64-bit time and offsets, we should make that as easy as possible.

Quoted 10 lines

That is, you need an RISC-V-specific bits/timesize.h. But you shouldn't need an RISC-V-specific bits/typesizes.h - rather, make the linux/generic one do the right thing for __TIME_T_TYPE based on bits/timesize.h. And have some other header that 32-bit linux/generic ports can use to say whether they use the 64-bit offset/stat/statfs interface, that bits/typesizes.h can use together with its existing __LP64__ check, and make the definitions of __OFF_T_TYPE etc. check that as well, and then you shouldn't need an RISC-V-specific bits/typesizes.h - the RISC-V-specific headers should be strictly minimal. (No architecture-specific bits/time64.h headers should be needed in any case.)

Ok, I have updated this. I'll send the patch once my "Always use 32-bit time_t for certain syscalls" series is in (the headers are changed in that series).

Alistair

Quoted 10 lines

At some point (or indeed now) we might flip the default for linux/generic so the architectures needing an architecture-specific header are only the older 32-bit linux/generic architectures that have support for 32-bit times and offsets, and the newer ones with no such support don't need such a header.

--
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#6 lore raw

switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Alistair, Arnd

Quoted 24 lines · Alistair Francis
Quoted 13 lines · Joseph Myers
Quoted 8 lines · Alistair Francis
Quoted 6 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 5 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +0 -0
new file mode 100644
index 0000000000..0da3bdeb5d

I was hoping newer arches could simply use the asm-generic one ?

We need to specify that RV32 uses a 64-bit time_t. The generic ones don't do that for 32-bit arches.

Since it seems we'd like future 32-bit ports of glibc to use 64-bit time and offsets, we should make that as easy as possible.

Quoted 10 lines

That is, you need an RISC-V-specific bits/timesize.h. But you shouldn't need an RISC-V-specific bits/typesizes.h - rather, make the linux/generic one do the right thing for __TIME_T_TYPE based on bits/timesize.h. And have some other header that 32-bit linux/generic ports can use to say whether they use the 64-bit offset/stat/statfs interface, that bits/typesizes.h can use together with its existing __LP64__ check, and make the definitions of __OFF_T_TYPE etc. check that as well, and then you shouldn't need an RISC-V-specific bits/typesizes.h - the RISC-V-specific headers should be strictly minimal. (No architecture-specific bits/time64.h headers should be needed in any case.)

Quoted 3 lines

Ok, I have updated this. I'll send the patch once my "Always use 32-bit time_t for certain syscalls" series is in (the headers are changed in that series).

I guess you haven't pushed changes yet, which don't make full copy of typesizes.h ?

Anyhow I have a version based on your prior next branch where I switched ARC to 64-bit time_t - things work fine in general but I see some additional failures with the testsuite.

Consider io/test-stat2.c which calls stat() and stat64() and compares the results:
it now fails for ctime mismatch

| ...
| st_atime: [72] 644245094405576070 vs [72] 644245094405576070  OK
| st_mtime: [88] 1975684956160000000 vs [88] 1975684956160000000  OK
| st_ctime: [104] 0 vs [104] 2306351876938924035  FAIL

In kernel asm-generic stat64 has 32-bit ctime (secs)

    struct stat64 {
    ...
        int                   st_atime;            <-- offset 72 unsigned int    st_atime_nsec;
        int                   st_mtime;            <-- offset *80* unsigned int    st_mtime_nsec;
        int                   st_ctime;            <-- offset 92 unsigned int    st_ctime_nsec;
    ...
    };

In glibc, we have 64-bit time_t based timestamps so the structure diverges with kernel counterpart from time fields onwards.

    __extension__ typedef __int64_t __time_t;        <-- ARC switched to 64-bit time_t

    struct timespec
    {
      __time_t tv_sec;    <-- 8
      long int tv_nsec;    <-- 4
      int: 32;                   <-- 4
    };

    struct stat64
      {
    ...
        struct timespec st_atim;    <-- offset 72 struct timespec st_mtim;    <-- offset *88* struct timespec st_ctim;    <-- offset 104 int __glibc_reserved[2];
      };

However glibc stat64()wrapper calls sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c

which for ARC is just doing a pass thru syscall because we do have __NR_fstatat64
- hence the issues I see.

It needs itemized copy

    __xstat64 (int vers, const char *name, struct stat64 *buf)
    {
    #ifdef __NR_fstatat64
          return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0); #else
    ....
          int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, AT_NO_AUTOMOUNT, STATX_BASIC_STATS, &tmp); __cp_stat64_statx (buf, &tmp);
    #endif

An the reason this all works on RISCV is that your kernel doesn't define __ARCH_WANT_STAT64 -> lacks __NR_statat64 and instead uses the statx call which does itemized copy and would work fine when copying from 32-bits time (in kernel) to 64-bits container in glibc. Is this is right understanding or am I missing something here.

How do I build a latest RISCV 32-bit kernel + userland - do you have a buildroot branch somewhere that I can build / test with qemu ?

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#7 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 5 lines · Vineet Gupta

An the reason this all works on RISCV is that your kernel doesn't define __ARCH_WANT_STAT64 -> lacks __NR_statat64 and instead uses the statx call which does itemized copy and would work fine when copying from 32-bits time (in kernel) to 64-bits container in glibc. Is this is right understanding or am I missing something here.

That looks right - so you'll need a way (e.g. a new macro in kernel_stat.h) to tell the stat implementations to use the statx path even though the older stat64 syscalls exist.

Signature · 7 lines
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#8 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Joseph, Vineet,

Quoted 9 lines · Vineet Gupta
Quoted 7 lines

An the reason this all works on RISCV is that your kernel doesn't define __ARCH_WANT_STAT64 -> lacks __NR_statat64 and instead uses the statx call which does itemized copy and would work fine when copying from 32-bits time (in kernel) to 64-bits container in glibc. Is this is right understanding or am I missing something here.

Quoted 4 lines

That looks right - so you'll need a way (e.g. a new macro in kernel_stat.h) to tell the stat implementations to use the statx path even though the older stat64 syscalls exist.

Similar issue is on ARM32 (armv7). It also uses stat instead of statx (and also needs some conversion to 64 bit types). Potential conversion patch could be reused on ARM32 as well.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#9 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

In reply to Vineet Gupta

Hi Vineet,

Quoted 106 lines

Hi Alistair, Arnd

Quoted 28 lines · Alistair Francis
Quoted 14 lines · Joseph Myers
Quoted 9 lines · Alistair Francis
Quoted 7 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 5 lines
(quoted diff) +0 -0

b/sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file mode 100644 index 0000000000..0da3bdeb5d

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +0 -0

I was hoping newer arches could simply use the asm-generic one ?

We need to specify that RV32 uses a 64-bit time_t. The generic ones don't do that for 32-bit arches.

Since it seems we'd like future 32-bit ports of glibc to use 64-bit time and offsets, we should make that as easy as possible.

Quoted 12 lines

That is, you need an RISC-V-specific bits/timesize.h. But you shouldn't need an RISC-V-specific bits/typesizes.h - rather, make the linux/generic one do the right thing for __TIME_T_TYPE based on bits/timesize.h. And have some other header that 32-bit linux/generic ports can use to say whether they use the 64-bit offset/stat/statfs interface, that bits/typesizes.h can use together with its existing __LP64__ check, and make the definitions of __OFF_T_TYPE etc. check that as well, and then you shouldn't need an RISC-V-specific bits/typesizes.h - the RISC-V-specific headers should be strictly minimal. (No architecture-specific bits/time64.h headers should be needed in any case.)

Quoted 3 lines

Ok, I have updated this. I'll send the patch once my "Always use 32-bit time_t for certain syscalls" series is in (the headers are changed in that series).

I guess you haven't pushed changes yet, which don't make full copy of typesizes.h ?

Anyhow I have a version based on your prior next branch where I switched ARC to 64-bit time_t - things work fine in general but I see some additional failures with the testsuite.

Consider io/test-stat2.c which calls stat() and stat64() and compares the results: it now fails for ctime mismatch

| ...
| st_atime: [72] 644245094405576070 vs [72] 644245094405576070  OK
| st_mtime: [88] 1975684956160000000 vs [88] 1975684956160000000  OK
| st_ctime: [104] 0 vs [104] 2306351876938924035  FAIL

In kernel asm-generic stat64 has 32-bit ctime (secs)

    struct stat64 {
    ...
        int                   st_atime;            <-- offset 72 unsigned int    st_atime_nsec;
        int                   st_mtime;            <-- offset *80* unsigned int    st_mtime_nsec;
        int                   st_ctime;            <-- offset 92 unsigned int    st_ctime_nsec;
    ...
    };

In glibc, we have 64-bit time_t based timestamps so the structure diverges with kernel counterpart from time fields onwards.

    __extension__ typedef __int64_t __time_t;        <-- ARC switched to 64-bit time_t

    struct timespec
    {
      __time_t tv_sec;    <-- 8
      long int tv_nsec;    <-- 4
      int: 32;                   <-- 4
    };

    struct stat64
      {
    ...
        struct timespec st_atim;    <-- offset 72 struct timespec st_mtim;    <-- offset *88* struct timespec st_ctim;    <-- offset 104 int __glibc_reserved[2];
      };

However glibc stat64()wrapper calls sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c

which for ARC is just doing a pass thru syscall because we do have __NR_fstatat64
- hence the issues I see.

It needs itemized copy

    __xstat64 (int vers, const char *name, struct stat64 *buf) {
    #ifdef __NR_fstatat64
          return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0); #else
    ....
          int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, AT_NO_AUTOMOUNT, STATX_BASIC_STATS, &tmp); __cp_stat64_statx (buf, &tmp);
    #endif

Quoted 8 lines

An the reason this all works on RISCV is that your kernel doesn't define __ARCH_WANT_STAT64 -> lacks __NR_statat64 and instead uses the statx call which does itemized copy and would work fine when copying from 32-bits time (in kernel) to 64-bits container in glibc. Is this is right understanding or am I missing something here.

How do I build a latest RISCV 32-bit kernel + userland - do you have a buildroot branch somewhere that I can build / test with qemu ?

Maybe a bit off topic - there is such QEMU and Yocto/OE based test sandbox for ARM32:

https://github.com/lmajewski/meta-y2038

(the README provides steps for setup).

Quoted 6 lines

Thx,
-Vineet

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#10 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 11 lines · Lukasz Majewski
Quoted 10 lines · Alistair Francis
Quoted 1 line

On Tue, Feb 11, 2020 at 5:30 PM Joseph Myers

An the reason this all works on RISCV is that your kernel doesn't define __ARCH_WANT_STAT64 -> lacks __NR_statat64 and instead uses the statx call which does itemized copy and would work fine when copying from 32-bits time (in kernel) to 64-bits container in glibc. Is this is right understanding or am I missing something here.

How do I build a latest RISCV 32-bit kernel + userland - do you have a buildroot branch somewhere that I can build / test with qemu ?

Quoted 6 lines

Maybe a bit off topic - there is such QEMU and Yocto/OE based test sandbox for ARM32:

https://github.com/lmajewski/meta-y2038

(the README provides steps for setup).

(continuing off-topic, with debian-arm and Helmut on Cc)

Would it be possible to take a snapshot of your glibc tree and start testing this out with debian-rebootstrap [1]?

Are there any glibc issues that prevent it from working correctly, aside from the exact ABI not being final yet?

Arnd

[1] https://wiki.debian.org/HelmutGrohne/rebootstrap

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#11 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Arnd,

Quoted 18 lines
Quoted 16 lines · Lukasz Majewski
Quoted 9 lines · Alistair Francis
Quoted 1 line

On Tue, Feb 11, 2020 at 5:30 PM Joseph Myers

An the reason this all works on RISCV is that your kernel doesn't define __ARCH_WANT_STAT64 -> lacks __NR_statat64 and instead uses the statx call which does itemized copy and would work fine when copying from 32-bits time (in kernel) to 64-bits container in glibc. Is this is right understanding or am I missing something here.

Quoted 3 lines

How do I build a latest RISCV 32-bit kernel + userland - do you have a buildroot branch somewhere that I can build / test with qemu ?

Maybe a bit off topic - there is such QEMU and Yocto/OE based test sandbox for ARM32:

Quoted 7 lines
Quoted 3 lines

https://github.com/lmajewski/meta-y2038

(the README provides steps for setup).

(continuing off-topic, with debian-arm and Helmut on Cc)

Would it be possible to take a snapshot of your glibc tree

The description of the status of Y2038 supporting glibc on ARM 32 can be found here [1].

The most recent patches for Y2038 supporting glibc can be always found in the 'y2038_edge' branch [2].

I also do have a 'warrior' based glibc branch [3], which is a bunch of hacks to have glibc 2.29 Y2038 supporting. However, my policy now is "upstream first" - so I would recommend adding any further glibc work on top of [2].

Quoted 2 lines

and
start testing this out with debian-rebootstrap [1]?

I've been using OE/Yocto for testing as it allows building glibc sources for x86_64, x86, x86-x32, arm32 (probably also for ppc32 and mips - but not tested).

I'm able to use runqemu to test the built glibc with kernel 4.19, 5.1 (for armv7).
This qemu run system can be used to run-test glibc tests on ARM32 with test-wrapper='/opt/Y2038/glibc/src/scripts/cross-test-ssh.sh

Last but not least - OE/Yocto is used to provide BSP for embedded systems, so I'm aligned with customers' needs.

However, I did not yet tried debian-rebootstrap. I will look if this can be reused as well.

Quoted 2 lines

Are there any glibc issues that prevent it from working correctly,

I think that the glibc wrappers for most important syscalls are now converted.

What is missing:

- NTPL (threads)
- stat
- In-glibc test coverage when -D_TIME_BITS=64 is used. I do have some basic tests [4], but this may be not enough.

Quoted 5 lines

aside from the exact ABI not being final yet?

Arnd

[1] https://wiki.debian.org/HelmutGrohne/rebootstrap

Links:

[1] -
https://github.com/lmajewski/y2038_glibc/commit/4f72f695d1ac428fe945cd7d5e95770180d4a7c1
[2] - https://github.com/lmajewski/y2038_glibc/commits/y2038_edge
[3] -
https://github.com/lmajewski/y2038_glibc/commits/Y2038-2.29-glibc-warrior-01-08-2019

[4] - https://github.com/lmajewski/y2038-tests

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#12 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 9 lines · Lukasz Majewski
Quoted 3 lines

On Thu, Feb 20, 2020 at 12:11 AM Lukasz Majewski <[email protected]>

Would it be possible to take a snapshot of your glibc tree

The description of the status of Y2038 supporting glibc on ARM 32 can be found here [1].

The most recent patches for Y2038 supporting glibc can be always found in the 'y2038_edge' branch [2].

Ok.

Quoted 8 lines
Quoted 1 line

and start testing this out with debian-rebootstrap [1]?

I've been using OE/Yocto for testing as it allows building glibc sources for x86_64, x86, x86-x32, arm32 (probably also for ppc32 and mips - but not tested).
...
However, I did not yet tried debian-rebootstrap. I will look if this can be reused as well.

The reason I'm asking about debian-rebootstrap is less about testing glibc itself than about testing the rest of user space to figure out better what needs to be done when rebuilding with _TIME_BITS=64, and to start fixing more upstream packages, with the hope of having enough of it done in time for the Debian 11 release.

Quoted 9 lines
Quoted 1 line

Are there any glibc issues that prevent it from working correctly,

I think that the glibc wrappers for most important syscalls are now converted.

What is missing:

- NTPL (threads)
- stat

Do you mean that code using these will fail to work correctly with -D_TIME_BITS=64 at the moment, or that the interfaces are there but they are not y2038 safe? Without pthreads or stat, we probably wouldn't get too far in rebootstrap, but if the interfaces are there and mostly work, then we don't need to rely on them being y2038-safe just yet. An obvious next step would be to run the resulting code with the RTC set 20 years ahead, and that requires it all to work.

Quoted 2 lines

- In-glibc test coverage when -D_TIME_BITS=64 is used. I do have some basic tests [4], but this may be not enough.

This is probably something where debian-rebootstrap could help, as building and testing more user space packages will excercise additional code paths in glibc as well. There is also some work in Linaro to ensure that LTP tests the low-level syscall interfaces in both the time32 and time64 variants.

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#13 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Arnd,

Quoted 23 lines
Quoted 9 lines · Lukasz Majewski
Quoted 3 lines

On Thu, Feb 20, 2020 at 12:11 AM Lukasz Majewski <[email protected]>

Would it be possible to take a snapshot of your glibc tree

The description of the status of Y2038 supporting glibc on ARM 32 can be found here [1].

The most recent patches for Y2038 supporting glibc can be always found in the 'y2038_edge' branch [2].

Ok.

Quoted 8 lines
Quoted 1 line

and start testing this out with debian-rebootstrap [1]?

I've been using OE/Yocto for testing as it allows building glibc sources for x86_64, x86, x86-x32, arm32 (probably also for ppc32 and mips - but not tested).
...
However, I did not yet tried debian-rebootstrap. I will look if this can be reused as well.

Quoted 5 lines

The reason I'm asking about debian-rebootstrap is less about testing glibc itself than about testing the rest of user space to figure out better what needs to be done when rebuilding with _TIME_BITS=64, and to start fixing more upstream packages, with the hope of having enough of it done in time for the Debian 11 release.

Ok. I see. Thanks for the information.

Validating the packages was one of the reasons to move from some custom made test images/setup to Yocto/OE (as it is very close to customers needs).

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Are there any glibc issues that prevent it from working correctly,

I think that the glibc wrappers for most important syscalls are now converted.

Quoted 8 lines
Quoted 4 lines

What is missing:

- NTPL (threads)
- stat

Do you mean that code using these will fail to work correctly with -D_TIME_BITS=64 at the moment, or that the interfaces are there but they are not y2038 safe?

For ARM32 (branch [2]):

- Without -D_TIME_BITS=64 defined during compilation (as we do have now) the glibc is fully functional, but when you set date after 03:14:08 UTC on 19.01.2038 you will see the date reset (to 1901) in the user space programs (after calling e.g. 'date').

- With -D_TIME_BITS=64 set during compilation - and using branch [2] - syscalls listed in [1] will provide correct date after Y2038 32 bit overflow. Other (i.e. not converted ones) will use overflow date (1901 year). The glibc will also be fully functional up till Y2038 overflow.

Quoted 4 lines

Without pthreads or stat, we probably
wouldn't get too far in rebootstrap, but if the interfaces are there and mostly work, then we don't need to rely on them being y2038-safe just yet.

According to my above statement the second assumption is correct.

Quoted 3 lines

An obvious next step would be to run the
resulting code with the RTC set 20 years ahead, and that requires it all to work.

Yes. This is what I do for the test setup [3]. I do use clock_settime syscall (now it is working correctly) or just 'date' from user space.

Quoted 7 lines
Quoted 3 lines

- In-glibc test coverage when -D_TIME_BITS=64 is used. I do have some basic tests [4], but this may be not enough.

This is probably something where debian-rebootstrap could help, as building and testing more user space packages will excercise additional code paths in glibc as well.

Yes this _could_ help. Do you have any tutorial/howto similar to one from [4]?

I also think that some tests from debian-rebootstrap could be moved to glibc test framework (test suite). For example tests for clock_settime/gettime/nanosleep/ etc. In that way the glibc-many-build.py would run those tests for all supported ports.

Then the debian-rebootstrap could test for more sophisticated bugs (like dependencies between syscalls, etc).

Quoted 3 lines

There is also some work
in Linaro to ensure that LTP tests the low-level syscall interfaces in both the time32 and time64 variants.

Interesting. Is this work now publicly available?

Quoted 2 lines

Arnd

Links:

[1] -
https://github.com/lmajewski/y2038_glibc/commit/4f72f695d1ac428fe945cd7d5e95770180d4a7c1
[2] - https://github.com/lmajewski/y2038_glibc/commits/y2038_edge
[3] - https://github.com/lmajewski/y2038-tests
[4] - https://github.com/lmajewski/meta-y2038/blob/master/README

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#14 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 18 lines · Lukasz Majewski
Quoted 9 lines
Quoted 7 lines · Lukasz Majewski
Quoted 3 lines

On Thu, Feb 20, 2020 at 12:11 AM Lukasz Majewski <[email protected]> Are there any glibc issues that prevent it from working correctly,

I think that the glibc wrappers for most important syscalls are now converted.

Quoted 8 lines
Quoted 4 lines

What is missing:

- NTPL (threads)
- stat

Do you mean that code using these will fail to work correctly with -D_TIME_BITS=64 at the moment, or that the interfaces are there but they are not y2038 safe?

Quoted 6 lines

For ARM32 (branch [2]):

- Without -D_TIME_BITS=64 defined during compilation (as we do have now) the glibc is fully functional, but when you set date after 03:14:08 UTC on 19.01.2038 you will see the date reset (to 1901) in the user space programs (after calling e.g. 'date').

I'd actually consider intentionally breaking this for a Debian bootstrap, at least initially, so that any application that accidentally gets built without
-D_TIME_BITS=64 runs into a build or link failure.

Quoted 4 lines

- With -D_TIME_BITS=64 set during compilation - and using branch [2] - syscalls listed in [1] will provide correct date after Y2038 32 bit overflow. Other (i.e. not converted ones) will use overflow date (1901 year). The glibc will also be fully functional up till Y2038 overflow.

Ok.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

- In-glibc test coverage when -D_TIME_BITS=64 is used. I do have some basic tests [4], but this may be not enough.

This is probably something where debian-rebootstrap could help, as building and testing more user space packages will excercise additional code paths in glibc as well.

Yes this _could_ help. Do you have any tutorial/howto similar to one from [4]?

Not sure, maybe Helmut has some references.

Quoted 5 lines
Quoted 3 lines

There is also some work
in Linaro to ensure that LTP tests the low-level syscall interfaces in both the time32 and time64 variants.

Interesting. Is this work now publicly available?

I think this is currently in the planning stage, but once patches are available, they would be posted to the ltp mailing list. Viresh should have more details on this.

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#15 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Arnd,

Quoted 26 lines · Lukasz Majewski
Quoted 18 lines
Quoted 9 lines
Quoted 7 lines · Lukasz Majewski
Quoted 3 lines

On Thu, Feb 20, 2020 at 12:11 AM Lukasz Majewski <[email protected]> Are there any glibc issues that prevent it from working correctly,

I think that the glibc wrappers for most important syscalls are now converted.

Quoted 8 lines
Quoted 4 lines

What is missing:

- NTPL (threads)
- stat

Do you mean that code using these will fail to work correctly with -D_TIME_BITS=64 at the moment, or that the interfaces are there but they are not y2038 safe?

Quoted 6 lines

For ARM32 (branch [2]):

- Without -D_TIME_BITS=64 defined during compilation (as we do have now) the glibc is fully functional, but when you set date after 03:14:08 UTC on 19.01.2038 you will see the date reset (to 1901)
in the user space programs (after calling e.g. 'date').

Quoted 4 lines

I'd actually consider intentionally breaking this for a Debian bootstrap, at least initially, so that any application that accidentally gets built without -D_TIME_BITS=64 runs into a build or link failure.

I do see two approaches here:

1. In glibc:

When -D_TIME_BITS=64 is set - redirections are enabled for syscall wrappers; for example __clock_settime64 is used instead of __clock_settime (e.g. sysdeps/unix/sysv/linux/clock_settime).

The latter is guarded by #ifdef __TIMESIZE != 64 so we could change mechanically that __clock_settime returns -1 and sets errno to -ENOTSUPP

2. In kernel - return -ENOTSUPP when clock_settime syscall instead of clock_settime64 is invoked.

Quoted 25 lines
Quoted 6 lines

- With -D_TIME_BITS=64 set during compilation - and using branch
[2] - syscalls listed in [1] will provide correct date after Y2038 32 bit overflow. Other (i.e. not converted ones) will use overflow date (1901 year). The glibc will also be fully functional up till Y2038 overflow.

Ok.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

- In-glibc test coverage when -D_TIME_BITS=64 is used. I do have some basic tests [4], but this may be not enough.

This is probably something where debian-rebootstrap could help, as building and testing more user space packages will excercise additional code paths in glibc as well.

Yes this _could_ help. Do you have any tutorial/howto similar to one from [4]?

Not sure, maybe Helmut has some references.

Quoted 4 lines
Quoted 3 lines

There is also some work
in Linaro to ensure that LTP tests the low-level syscall interfaces in both the time32 and time64 variants.

Quoted 7 lines
Quoted 1 line

Interesting. Is this work now publicly available?

I think this is currently in the planning stage, but once patches are available, they would be posted to the ltp mailing list. Viresh should have more details on this.

Arnd

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#16 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 5 lines · Lukasz Majewski
Quoted 1 line · Lukasz Majewski

I do see two approaches here:

Quoted 8 lines

1. In glibc:

When -D_TIME_BITS=64 is set - redirections are enabled for syscall wrappers; for example __clock_settime64 is used instead of __clock_settime (e.g. sysdeps/unix/sysv/linux/clock_settime).

The latter is guarded by #ifdef __TIMESIZE != 64 so we could change mechanically that __clock_settime returns -1 and sets errno to -ENOTSUPP

What I meant is to remove the __clock_settime function from the library entirely to cause a link failure. I suppose replacing most "__TIMESIZE != 64" with '0' would do that. Ideally I'd just set __TIMESIZE to 64, but doing that would make the ABI incompatible with mainline glibc.

Quoted 2 lines

2. In kernel - return -ENOTSUPP when clock_settime syscall instead of clock_settime64 is invoked.

We already have that with CONFIG_COMPAT_32BIT_TIME, but at the moment I think that still breaks glibc's usage of __NR_futex, and a compile-time error is always better than a runtime error, as it's easier to catch them reliably

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#17 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Arnd,

Quoted 13 lines · Lukasz Majewski
Quoted 12 lines
Quoted 2 lines

On Thu, Feb 20, 2020 at 2:15 PM Lukasz Majewski <[email protected]> wrote:

I do see two approaches here:

1. In glibc:

When -D_TIME_BITS=64 is set - redirections are enabled for syscall wrappers; for example __clock_settime64 is used instead of __clock_settime (e.g. sysdeps/unix/sysv/linux/clock_settime).

Quoted 7 lines
Quoted 3 lines

The latter is guarded by #ifdef __TIMESIZE != 64 so we could change mechanically that __clock_settime returns -1 and sets errno to -ENOTSUPP

What I meant is to remove the __clock_settime function from the library entirely to cause a link failure. I suppose replacing most "__TIMESIZE != 64" with '0' would do that. Ideally I'd just set

I think that replacing "__TIMESIZE != 64" with '0' would be the simplest option.

Quoted 10 lines

__TIMESIZE to 64, but doing that would make the ABI incompatible with mainline glibc.

Quoted 2 lines

2. In kernel - return -ENOTSUPP when clock_settime syscall instead of clock_settime64 is invoked.

We already have that with CONFIG_COMPAT_32BIT_TIME, but at the moment I think that still breaks glibc's usage of __NR_futex, and a compile-time error is always better than a runtime error, as it's easier to catch them reliably

Ok.

Quoted 2 lines

Arnd

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#18 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Lukasz Majewski
Quoted 6 lines

On Thu, Feb 20, 2020 at 10:37 AM Lukasz Majewski <[email protected]>

Quoted 1 line
Quoted 1 line

On Thu, Feb 20, 2020 at 12:11 AM Lukasz Majewski <[email protected]>

There is also some work
in Linaro to ensure that LTP tests the low-level syscall interfaces in both the time32 and time64 variants.

Quoted 5 lines
Quoted 1 line

Interesting. Is this work now publicly available?

I think this is currently in the planning stage, but once patches are available, they would be posted to the ltp mailing list. Viresh should have more details on this.

What you said is correct Arnd. It is in very early stage of planning right now, no guarantees on when will we start working on it as of now.

Signature · 6 lines
viresh

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#19 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

In reply to Arnd Bergmann
Quoted 23 lines · Arnd Bergmann
Quoted 9 lines · Lukasz Majewski
Quoted 3 lines

On Thu, Feb 20, 2020 at 12:11 AM Lukasz Majewski <[email protected]>

Would it be possible to take a snapshot of your glibc tree

The description of the status of Y2038 supporting glibc on ARM 32 can be found here [1].

The most recent patches for Y2038 supporting glibc can be always found in the 'y2038_edge' branch [2].

Ok.

Quoted 8 lines
Quoted 1 line

and start testing this out with debian-rebootstrap [1]?

I've been using OE/Yocto for testing as it allows building glibc sources for x86_64, x86, x86-x32, arm32 (probably also for ppc32 and mips - but not tested).
...
However, I did not yet tried debian-rebootstrap. I will look if this can be reused as well.

Quoted 5 lines

The reason I'm asking about debian-rebootstrap is less about testing glibc itself than about testing the rest of user space to figure out better what needs to be done when rebuilding with _TIME_BITS=64, and to start fixing more upstream packages, with the hope of having enough of it done in time for the Debian 11 release.

We have started to do that for RISC-V 32-bit. I have fixed up some things in Busybox and OpenSSL to improve 64-bit time_t support on 32-bit archs. In meta-riscv (and OpenEmbedded layer) we are tracking
issues: https://github.com/riscv/meta-riscv/issues/202

Right now it's all compile focused though, not so much run time testing.

Alistair

Quoted 23 lines
Quoted 10 lines
Quoted 2 lines

Are there any glibc issues that prevent it from working correctly,

I think that the glibc wrappers for most important syscalls are now converted.

What is missing:

- NTPL (threads)
- stat

Do you mean that code using these will fail to work correctly with -D_TIME_BITS=64 at the moment, or that the interfaces are there but they are not y2038 safe? Without pthreads or stat, we probably wouldn't get too far in rebootstrap, but if the interfaces are there and mostly work, then we don't need to rely on them being y2038-safe just yet. An obvious next step would be to run the resulting code with the RTC set 20 years ahead, and that requires it all to work.

Quoted 2 lines

- In-glibc test coverage when -D_TIME_BITS=64 is used. I do have some basic tests [4], but this may be not enough.

Quoted 7 lines

This is probably something where debian-rebootstrap could help, as building and testing more user space packages will excercise additional code paths in glibc as well. There is also some work in Linaro to ensure that LTP tests the low-level syscall interfaces in both the time32 and time64 variants.

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#20 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

In reply to Lukasz Majewski
Quoted 1 line · Lukasz Majewski

[2] - https://github.com/lmajewski/y2038_glibc/commits/y2038_edge

I tried packaging this into a .deb package for use with rebootstrap, but ran into a couple of test failures from glibc itself, when testing the i386 version while running on an older x86_64 kernel (4.15):

+---------------------------------------------------------------------+
|     Encountered regressions that don't match expected failures.     |
+---------------------------------------------------------------------+

FAIL: elf/check-localplt
FAIL: nptl/tst-cancel19
FAIL: rt/tst-mqueue2
make: *** [debian/rules.d/build.mk:116:
/home/arnd/glibc-2.31/stamp-dir/check_i386] Error 1

elf/check-localplt complains about the newly added symbols

Extra PLT reference: libc.so: __lutimes64 Extra PLT reference: libc.so: __wait4_time64 Extra PLT reference: libc.so: __setitimer64 Extra PLT reference: libc.so: __utime64
Extra PLT reference: libc.so: __timerfd_gettime64 Extra PLT reference: libc.so: __clock_settime64 Extra PLT reference: libc.so: __utimes64
Extra PLT reference: libc.so: __gettimeofday64 Extra PLT reference: libc.so: __clock_gettime64 Extra PLT reference: libc.so: __futimesat64 Extra PLT reference: libc.so: __clock_getres64 Extra PLT reference: libc.so: __futimes64 Extra PLT reference: libc.so: __futimens64 Extra PLT reference: libc.so: __utimensat64 Extra PLT reference: libc.so: __getrusage64 Extra PLT reference: libc.so: __timespec_get64 Extra PLT reference: libc.so: __getitimer64 Extra PLT reference: libc.so: __ppoll64
Extra PLT reference: libc.so: __timerfd_settime64 Extra PLT reference: libc.so: __clock_nanosleep_time64 Extra PLT reference: libc.so: __sched_rr_get_interval64 Extra PLT reference: libc.so: __settimeofday64 Extra PLT reference: librt.so: __timer_gettime64 Extra PLT reference: librt.so: __mq_timedreceive_time64 Extra PLT reference: librt.so: __mq_timedsend_time64 Extra PLT reference: librt.so: __timer_settime64

which seems a bug in the test suite. The other two get a segfault that I have not debugged, but I guess this is likely a problem in your patches. Have you seen the same thing?

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#21 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Arnd,

Quoted 9 lines
Quoted 1 line · Lukasz Majewski

[2] - https://github.com/lmajewski/y2038_glibc/commits/y2038_edge

I tried packaging this into a .deb package for use with rebootstrap, but ran into a couple of test failures from glibc itself, when testing the i386 version while running on an older x86_64 kernel (4.15):

Thanks for testing. I do use 4.19 as the oldest kernel.

Quoted 30 lines
+---------------------------------------------------------------------+
|     Encountered regressions that don't match expected failures.
|
+---------------------------------------------------------------------+

FAIL: elf/check-localplt FAIL: nptl/tst-cancel19
FAIL: rt/tst-mqueue2
make: *** [debian/rules.d/build.mk:116:
/home/arnd/glibc-2.31/stamp-dir/check_i386] Error 1

elf/check-localplt complains about the newly added symbols

Extra PLT reference: libc.so: __lutimes64
Extra PLT reference: libc.so: __wait4_time64
Extra PLT reference: libc.so: __setitimer64
Extra PLT reference: libc.so: __utime64
Extra PLT reference: libc.so: __timerfd_gettime64
Extra PLT reference: libc.so: __clock_settime64
Extra PLT reference: libc.so: __utimes64
Extra PLT reference: libc.so: __gettimeofday64
Extra PLT reference: libc.so: __clock_gettime64
Extra PLT reference: libc.so: __futimesat64
Extra PLT reference: libc.so: __clock_getres64
Extra PLT reference: libc.so: __futimes64
Extra PLT reference: libc.so: __futimens64
Extra PLT reference: libc.so: __utimensat64
Extra PLT reference: libc.so: __getrusage64
Extra PLT reference: libc.so: __timespec_get64
Extra PLT reference: libc.so: __getitimer64
Extra PLT reference: libc.so: __ppoll64

Quoted 9 lines

Extra PLT reference: libc.so: __timerfd_settime64 Extra PLT reference: libc.so: __clock_nanosleep_time64 Extra PLT reference: libc.so: __sched_rr_get_interval64 Extra PLT reference: libc.so: __settimeofday64 Extra PLT reference: librt.so: __timer_gettime64 Extra PLT reference: librt.so: __mq_timedreceive_time64 Extra PLT reference: librt.so: __mq_timedsend_time64 Extra PLT reference: librt.so: __timer_settime64

The above problems are somewhat expected. Those are redirected symbols, which are exported as GLIBC_PRIVATE in several Versions files.

I do guess that we will have a consensus if we add those as a "normal" exported symbols or keep them "private".

Quoted 3 lines

which seems a bug in the test suite. The other two get a segfault that I have not debugged, but I guess this is likely a problem in your patches. Have you seen the same thing?

I only do run the full (including full test suite) glibc-many-build (and my Y2038 tests) on the patches which I post to glibc-alpha.

The Y2038 changes I do test manually if they work as expected - but I do not run yet the (full) test suites on it, as first _all_ glibc functions needs to be converted before _TIME_BITS=64 is added.

The issue is probably with the redirection code. I will look on them soon.

Quoted 2 lines

Arnd

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#22 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 30 lines · Lukasz Majewski
Quoted 20 lines

elf/check-localplt complains about the newly added symbols

Extra PLT reference: libc.so: __lutimes64 Extra PLT reference: libc.so: __wait4_time64 Extra PLT reference: libc.so: __setitimer64 Extra PLT reference: libc.so: __utime64
Extra PLT reference: libc.so: __timerfd_gettime64 Extra PLT reference: libc.so: __clock_settime64 Extra PLT reference: libc.so: __utimes64 Extra PLT reference: libc.so: __gettimeofday64 Extra PLT reference: libc.so: __clock_gettime64 Extra PLT reference: libc.so: __futimesat64 Extra PLT reference: libc.so: __clock_getres64 Extra PLT reference: libc.so: __futimes64 Extra PLT reference: libc.so: __futimens64 Extra PLT reference: libc.so: __utimensat64 Extra PLT reference: libc.so: __getrusage64 Extra PLT reference: libc.so: __timespec_get64 Extra PLT reference: libc.so: __getitimer64 Extra PLT reference: libc.so: __ppoll64

Quoted 9 lines

Extra PLT reference: libc.so: __timerfd_settime64 Extra PLT reference: libc.so: __clock_nanosleep_time64 Extra PLT reference: libc.so: __sched_rr_get_interval64 Extra PLT reference: libc.so: __settimeofday64 Extra PLT reference: librt.so: __timer_gettime64 Extra PLT reference: librt.so: __mq_timedreceive_time64 Extra PLT reference: librt.so: __mq_timedsend_time64 Extra PLT reference: librt.so: __timer_settime64

Quoted 5 lines

The above problems are somewhat expected. Those are redirected symbols, which are exported as GLIBC_PRIVATE in several Versions files.

I do guess that we will have a consensus if we add those as a "normal" exported symbols or keep them "private".

They need to grow hidden aliases.

Andreas.

Signature · 8 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#23 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Andreas,

Quoted 32 lines · Lukasz Majewski
Quoted 31 lines
Quoted 30 lines

elf/check-localplt complains about the newly added symbols

Extra PLT reference: libc.so: __lutimes64 Extra PLT reference: libc.so: __wait4_time64 Extra PLT reference: libc.so: __setitimer64 Extra PLT reference: libc.so: __utime64
Extra PLT reference: libc.so: __timerfd_gettime64 Extra PLT reference: libc.so: __clock_settime64 Extra PLT reference: libc.so: __utimes64
Extra PLT reference: libc.so: __gettimeofday64 Extra PLT reference: libc.so: __clock_gettime64 Extra PLT reference: libc.so: __futimesat64 Extra PLT reference: libc.so: __clock_getres64 Extra PLT reference: libc.so: __futimes64 Extra PLT reference: libc.so: __futimens64 Extra PLT reference: libc.so: __utimensat64 Extra PLT reference: libc.so: __getrusage64 Extra PLT reference: libc.so: __timespec_get64 Extra PLT reference: libc.so: __getitimer64 Extra PLT reference: libc.so: __ppoll64
Extra PLT reference: libc.so: __timerfd_settime64 Extra PLT reference: libc.so: __clock_nanosleep_time64 Extra PLT reference: libc.so: __sched_rr_get_interval64 Extra PLT reference: libc.so: __settimeofday64 Extra PLT reference: librt.so: __timer_gettime64 Extra PLT reference: librt.so: __mq_timedreceive_time64 Extra PLT reference: librt.so: __mq_timedsend_time64 Extra PLT reference: librt.so: __timer_settime64

Quoted 8 lines
Quoted 6 lines

The above problems are somewhat expected. Those are redirected symbols, which are exported as GLIBC_PRIVATE in several Versions files.

I do guess that we will have a consensus if we add those as a "normal" exported symbols or keep them "private".

They need to grow hidden aliases.

Could you explain it a bit more?

If I add those functions as hidden_alias then those would be accessible inside glibc without PLT, but will not be exported (and redirection for Y2038 will not work).

Quoted 3 lines

Andreas.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#24 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 3 lines · Lukasz Majewski

If I add those functions as hidden_alias then those would be accessible inside glibc without PLT, but will not be exported (and redirection for Y2038 will not work).

They aren't? PLT avoidance is about internal references, and uses a different name then the exported sybmol.

Andreas.

Signature · 8 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#25 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 9 lines · On Mon, 24 Feb 2020 11:23:51 +0100 Andreas Schwab <[email protected]> wrote:
Quoted 3 lines · Lukasz Majewski

If I add those functions as hidden_alias then those would be accessible inside glibc without PLT, but will not be exported (and redirection for Y2038 will not work).

They aren't? PLT avoidance is about internal references, and uses a different name then the exported sybmol.

I'm probably not aware of something - but as done in the following patch:

https://github.com/lmajewski/y2038_glibc/commit/c96eeb73175961c4ac80fdd3b6adc132805387c9

I do need to remove librt_hidden_proto / librt_hidden_def to have proper symbols visible when I do want to use redirections.

(the same issue is with libc_hidden_proto / libc_hidden_def):
https://github.com/lmajewski/y2038_glibc/commit/361f05e38c0d5c6673914af330e766c2ed4f9a8a

Quoted 2 lines

Andreas.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#26 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 13 lines · Lukasz Majewski
Quoted 9 lines · On Mon, 24 Feb 2020 11:23:51 +0100 Andreas Schwab <[email protected]> wrote:
Quoted 3 lines · Lukasz Majewski

If I add those functions as hidden_alias then those would be accessible inside glibc without PLT, but will not be exported (and redirection for Y2038 will not work).

They aren't? PLT avoidance is about internal references, and uses a different name then the exported sybmol.

Quoted 7 lines

I'm probably not aware of something - but as done in the following patch:

https://github.com/lmajewski/y2038_glibc/commit/c96eeb73175961c4ac80fdd3b6adc132805387c9

I do need to remove librt_hidden_proto / librt_hidden_def to have proper symbols visible when I do want to use redirections.

You cannot redirect to GLIBC_PRIVATE symbols, they are not suposed to be used by public interfaces. All public interfaces need to use official versioned symbols.

Andreas.

Signature · 8 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#27 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 18 lines · On Mon, 24 Feb 2020 11:42:23 +0100 Andreas Schwab <[email protected]> wrote:
Quoted 16 lines · Lukasz Majewski
Quoted 9 lines · On Mon, 24 Feb 2020 11:23:51 +0100 Andreas Schwab <[email protected]> wrote:
Quoted 3 lines · Lukasz Majewski

If I add those functions as hidden_alias then those would be accessible inside glibc without PLT, but will not be exported (and redirection for Y2038 will not work).

They aren't? PLT avoidance is about internal references, and uses a different name then the exported sybmol.

I'm probably not aware of something - but as done in the following patch:

Quoted 9 lines
Quoted 4 lines

https://github.com/lmajewski/y2038_glibc/commit/c96eeb73175961c4ac80fdd3b6adc132805387c9

I do need to remove librt_hidden_proto / librt_hidden_def to have proper symbols visible when I do want to use redirections.

You cannot redirect to GLIBC_PRIVATE symbols, they are not suposed to be used by public interfaces. All public interfaces need to use official versioned symbols.

I've put those symbols to GLIBC_PRIVATE as up till now many more functions in glibc needs conversion to support 64 bit time. I need exported symbols to test if the redirection (and Y2038 safeness on ARM in general) works.

I also do guess that when we will be heading to expose _TIME_BITS==64 to outside word I would need to add:

  GLIBC_2.3X {
	clock_settime64;

}

for clock_settime64

and then:

#ifdef __USE_TIME_BITS64

# if defined(__REDIRECT_NTH)
extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const
struct timespec *__tp), clock_settime64);
# else
# define clock_settime clock_settime64
# endif
#endif

Am I correct ?

Quoted 2 lines

Andreas.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#28 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Dear All,

Quoted 36 lines
Quoted 18 lines · On Mon, 24 Feb 2020 11:42:23 +0100 Andreas Schwab <[email protected]> wrote:
Quoted 16 lines · Lukasz Majewski
Quoted 9 lines · On Mon, 24 Feb 2020 11:23:51 +0100 Andreas Schwab <[email protected]> wrote:
Quoted 3 lines · Lukasz Majewski

If I add those functions as hidden_alias then those would be accessible inside glibc without PLT, but will not be exported (and redirection for Y2038 will not work).

They aren't? PLT avoidance is about internal references, and uses a different name then the exported sybmol.

I'm probably not aware of something - but as done in the following patch:

Quoted 9 lines
Quoted 4 lines

https://github.com/lmajewski/y2038_glibc/commit/c96eeb73175961c4ac80fdd3b6adc132805387c9

I do need to remove librt_hidden_proto / librt_hidden_def to have proper symbols visible when I do want to use redirections.

You cannot redirect to GLIBC_PRIVATE symbols, they are not suposed to be used by public interfaces. All public interfaces need to use official versioned symbols.

I've put those symbols to GLIBC_PRIVATE as up till now many more functions in glibc needs conversion to support 64 bit time. I need exported symbols to test if the redirection (and Y2038 safeness on ARM in general) works.

Quoted 5 lines

I also do guess that when we will be heading to expose _TIME_BITS==64 to outside word I would need to add:

  GLIBC_2.3X {
	clock_settime64;
	^^^^^^^ - it should be __clock_settime64
Quoted 10 lines
  }

for clock_settime64

and then:

#ifdef __USE_TIME_BITS64

# if defined(__REDIRECT_NTH)
extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const
struct timespec *__tp), clock_settime64);
			  ^^^^^^ - __clock_settime64
Quoted 2 lines
# else
# define clock_settime clock_settime64
			 ^^^^^^ - __clock_settime64
Quoted 12 lines
# endif
#endif

Am I correct ?

Quoted 2 lines

Andreas.

Best regards,

Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
[email protected]

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#29 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

In reply to Lukasz Majewski
Quoted 7 lines · Lukasz Majewski

I'm probably not aware of something - but as done in the following patch:

https://github.com/lmajewski/y2038_glibc/commit/c96eeb73175961c4ac80fdd3b6adc132805387c9

I do need to remove librt_hidden_proto / librt_hidden_def to have proper symbols visible when I do want to use redirections.

You'll need to explain the actual problem you see, because lib<name>_hidden_proto / lib<name>_hidden_def are correct for any symbol that satisfies both of the following properties: (a) it is exported from shared lib<name> (whether at a public symbol version or version GLIBC_PRIVATE) and (b) it is also used within the library that defines it. They are useless but harmless for other symbols.

lib<name>_hidden_proto / lib<name>_hidden_def always need to be used together, and always need to have <name> matching the name of the shared library with the symbol. In C code, lib<name>_hidden_proto causes the function, for both definition and calls, to be redirected to an internal, hidden-visibility alias, while lib<name>_hidden_def then adds back the exported name as a non-hidden alias to cause it to be exported from the shared library in question.

It's true that the redirection from lib<name>_hidden_proto doesn't work when there is another redirection for the same symbol in effect, but that should not be a concern here (there should be no reason to have an asm redirection from __mq_timedreceive_time64 to another name, for example).

Signature · 7 lines
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#30 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Joseph,

Thanks for the detailed explanation.

Quoted 10 lines · Lukasz Majewski
Quoted 8 lines

I'm probably not aware of something - but as done in the following patch:

https://github.com/lmajewski/y2038_glibc/commit/c96eeb73175961c4ac80fdd3b6adc132805387c9

I do need to remove librt_hidden_proto / librt_hidden_def to have proper symbols visible when I do want to use redirections.

Quoted 7 lines

You'll need to explain the actual problem you see, because lib<name>_hidden_proto / lib<name>_hidden_def are correct for any symbol that satisfies both of the following properties: (a) it is exported from shared lib<name> (whether at a public symbol version or version GLIBC_PRIVATE) and (b) it is also used within the library that defines it. They are useless but harmless for other symbols.

Lets consider for example __mq_timedsend_time64.

With lib<name>_hidden_def/proto kept (NOT removed as in [1]):
GDB:
__GI___mq_timedsend_time64 [*]

(No build errors, linking with test setup works as expected).

(gdb) bt
#0 __libc_do_syscall () at../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1 0x76fc2696 in __GI___mq_timedsend_time64 (..) at../sysdeps/unix/sysv/linux/mq_timedsend.c:33
#2 0x76fc271a in __GI___mq_timedsend (..) at../sysdeps/unix/sysv/linux/mq_timedsend.c:69
#3 0x76fc2668 in mq_send () at ../sysdeps/unix/sysv/linux/mq_send.c:30

The problem is that __mq_timedsend (32 bit version) is called first - this means that the redirection for _TIME_BITS==64 (which would call __mq_timedsend_time64) is not working.

With lib<name>_hidden_def/proto removed (as it is now at [1])
#0 __mq_timedsend_time64 (..) at../sysdeps/unix/sysv/linux/mq_timedsend.c33 #1 0x00402bb0 in test_mq_timedsend_onqueue (q=3)
at test_mq_timedsend.c:25
#2 0x00402f28 in test_mq_timedsend () at test_mq_timedsend.c:130

The redirection for _TIME_BITS==64 works as expected.

The structure of time conversion patches (details in [2]):
@ include/time.h
#if __TIMESIZE == 64

# define __mq_timedsend_time64 __mq_timedsend
#else
# include <bits/types/struct___timespec64.h>
extern int __mq_timedsend_time64 (...);
librt_hidden_proto (__mq_timedsend_time64)
#endif

@sysdeps/unix/sysv/linux/mq_timedsend.c
int __mq_timedsend_time64 (...)
{

}

#if __TIMESIZE != 64
librt_hidden_def (__mq_timedsend_time64)

int __mq_timedsend (..)
{

}
#endif

hidden_def (__mq_timedsend)
weak_alias (__mq_timedsend, mq_timedsend) [**]
hidden_weak (mq_timedsend)

It looks to me like the [**] weak_alias () here is the problem as it does the aliasing for name, which shall be redirected to __mq_timedsend_time64.

However, when I remove the line [**] - I do see the error:

| In file included from <command-line>:
| ./../include/libc-symbols.h:552:33: error: '__EI_mq_timedsend' aliased to undefined symbol '__GI_mq_timedsend'

Quoted 7 lines

lib<name>_hidden_proto / lib<name>_hidden_def always need to be used together, and always need to have <name> matching the name of the shared library with the symbol. In C code, lib<name>_hidden_proto causes the function, for both definition and calls, to be redirected to an internal, hidden-visibility alias, while lib<name>_hidden_def then adds back the exported name as a non-hidden alias to cause it to be exported from the shared library in question.

I was not aware of the lib<name>_hidden_def () role to re-export the symbols again. Thanks for pointing this out.

Quoted 3 lines

It's true that the redirection from lib<name>_hidden_proto doesn't work when there is another redirection for the same symbol in effect,

Please correct me if I'm wrong, but from the above code snippet it looks like we do have (when _TIME_SIZE==64 is defined):

librt_hidden_proto (__mq_timedsend_time64)
librt_hidden_def (__mq_timedsend_time64)

hidden_def (__mq_timedsend)
weak_alias (__mq_timedsend, mq_timedsend)

And in exported headers:

# ifdef __USE_TIME_BITS64
#  if defined(__REDIRECT)
extern int __REDIRECT (mq_timedsend, (..),
     __mq_timedsend_time64);
#  else
#   define mq_timedsend __mq_timedsend_time64
#  endif
# endif

Unfortunately, the final redirection for mq_timedsend symbol is to __mq_timedsend, not __mq_timedsend_time64.

Quoted 4 lines

but that should not be a concern here (there should be no reason to have an asm redirection from __mq_timedreceive_time64 to another name, for example).

Question:

[*] - If I may ask - the __GI_ prefix is for glibc internal symbol? And in the same vein __EI_ is for external one?

Links:

[1] -
https://github.com/lmajewski/y2038_glibc/commit/06fe0342696d7c6fe6115f825052fb07bb609216

[2] - https://patchwork.ozlabs.org/patch/1237939/

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#31 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 7 lines · Lukasz Majewski

Lets consider for example __mq_timedsend_time64.

With lib<name>_hidden_def/proto kept (NOT removed as in [1]):
GDB:
__GI___mq_timedsend_time64 [*]

(No build errors, linking with test setup works as expected).

What is the actual testcase, and the exact command line used to compile it?

_TIME_BITS=64 redirection is only relevant for programs built with glibc, using the installed headers - not for building glibc itself.

lib<name>_hidden_proto is only relevant for building glibc, with its internal headers - not for programs built with glibc.

If you're talking about a glibc testcase, such tests should be in tests not tests-internal, so _ISOMAC is defined when they are built, so the glibc internal headers just wrap the public ones without defining anything else. In particular, the asm redirections from public headers should be in effect when tests are compiled, but not the lib<name>_hidden_proto redirections (but even for internal tests, lib<name>_hidden_proto shouldn't do anything because the build process knows they are tests not part of libc).

You should look at the preprocessed source from building the test with -save-temps and find out why the asm redirection from the public header isn't being effective (or if it is effective in the .o file for the test, look at what happens afterwards in glibc). Since lib<name>_hidden_proto should not be called in the parts of headers included when building a test, its presence or absence should have no effect on the preprocessed source of the test.

Quoted 3 lines

hidden_def (__mq_timedsend)
weak_alias (__mq_timedsend, mq_timedsend) [**]
hidden_weak (mq_timedsend)

If you have lib<name>_hidden_weak note you also need a corresponding lib<name>_hidden_proto, for the name of the weak alias. But you probably don't need to have lib<name>_hidden* for the weak alias at all, just make sure internal calls use the internal name.

Signature · 7 lines
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#32 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Joseph,

Quoted 12 lines · Lukasz Majewski
Quoted 8 lines

Lets consider for example __mq_timedsend_time64.

With lib<name>_hidden_def/proto kept (NOT removed as in [1]):
GDB:
__GI___mq_timedsend_time64 [*]

(No build errors, linking with test setup works as expected).

What is the actual testcase, and the exact command line used to compile it?

The test case is a separate program [1] compiled with [2] (the test_y2038 make target)

The glibc under test is installed on rootfs run by QEMU for ARM.

The lack of redirection, when I keep lib<name>_hidden_proto/ lib<name>_hidden_def for __mq_timedsend_time64, is seen when I debug with GDB the 'test_y2038' program.

The glibc compiles correctly.

Quoted 6 lines

_TIME_BITS=64 redirection is only relevant for programs built with glibc, using the installed headers - not for building glibc itself.

lib<name>_hidden_proto is only relevant for building glibc, with its internal headers - not for programs built with glibc.

It seems like not removing lib<name>_hidden_proto/ lib<name>_hidden_def for __mq_timedsend_time64 in glibc sources prevents the redirection on installed glibc / headers when 'test_y2038' program is run.

Quoted 9 lines

If you're talking about a glibc testcase, such tests should be in tests not tests-internal, so _ISOMAC is defined when they are built, so the glibc internal headers just wrap the public ones without defining anything else. In particular, the asm redirections from public headers should be in effect when tests are compiled, but not the lib<name>_hidden_proto redirections (but even for internal tests, lib<name>_hidden_proto shouldn't do anything because the build process knows they are tests not part of libc).

Unfortunately, mine Y2038 tests are a set of compiled programs (it is a 'legacy' code) and have nothing in common with glibc test suite.

The workflow is as follows (standard Yocto/OE):

1. Built the glibc and prepare "package" for other recipes.

2. For tests get the glibc "package" as a prerequisite. Use its exported headers and libraries to build tests. Prepare test "package"

3. Install both above packages to rootfs

4. Run the rootfs with QEMU.

Quoted 8 lines

You should look at the preprocessed source from building the test with -save-temps and find out why the asm redirection from the public header isn't being effective (or if it is effective in the .o file for the test, look at what happens afterwards in glibc). Since lib<name>_hidden_proto should not be called in the parts of headers included when building a test, its presence or absence should have no effect on the preprocessed source of the test.

Ok. I will dig the object files and generated temp files.

Quoted 9 lines
Quoted 4 lines

hidden_def (__mq_timedsend)
weak_alias (__mq_timedsend, mq_timedsend) [**]
hidden_weak (mq_timedsend)

If you have lib<name>_hidden_weak note you also need a corresponding lib<name>_hidden_proto, for the name of the weak alias. But you probably don't need to have lib<name>_hidden* for the weak alias at all, just make sure internal calls use the internal name.

As fair as I can tell the weak_alias () is necessary for correct operation of mq_timedsend when external programs call it.

Glibc internally defines __mq_timedsend (also for archs with __WORDSIZE==64), but it exports mq_timedsend (and user space programs call it). One needs an alias (at least a weak one) between mq_timedsend and __mq_timedsend{_time}. Am I correct?

Quoted 1 line

Links:

[1] -
https://github.com/lmajewski/y2038-tests/blob/master/test_mq_timedsend.c#L25

[2] - https://github.com/lmajewski/y2038-tests/blob/master/Makefile

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#33 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Quoted 11 lines · Lukasz Majewski
Quoted 8 lines
Quoted 3 lines

hidden_def (__mq_timedsend)
weak_alias (__mq_timedsend, mq_timedsend) [**]
hidden_weak (mq_timedsend)

If you have lib<name>_hidden_weak note you also need a corresponding lib<name>_hidden_proto, for the name of the weak alias. But you probably don't need to have lib<name>_hidden* for the weak alias at all, just make sure internal calls use the internal name.

As fair as I can tell the weak_alias () is necessary for correct operation of mq_timedsend when external programs call it.

I wasn't commenting on the weak_alias call, but on the hidden_weak one.

If you have hidden_weak (mq_timedsend), you also need lib<name>_hidden_proto (mq_timedsend) in the internal header (and vice versa, hidden_proto implies you need hidden_weak).

You don't need hidden_weak (mq_timedsend) unless there is an *internal call to mq_timedsend from within the same library that defines it*.

Since such an internal call could just use __mq_timedsend instead, you probably don't need hidden_weak / hidden_proto for mq_timedsend.

(If you don't have an internal call to __mq_timedsend, you don't need the hidden_* for that name either.)

Signature · 7 lines
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#34 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Hi Joseph,

Quoted 12 lines · Lukasz Majewski
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

hidden_def (__mq_timedsend)
weak_alias (__mq_timedsend, mq_timedsend) [**]
hidden_weak (mq_timedsend)

If you have lib<name>_hidden_weak note you also need a corresponding lib<name>_hidden_proto, for the name of the weak alias. But you probably don't need to have lib<name>_hidden* for the weak alias at all, just make sure internal calls use the internal name.

Quoted 5 lines
Quoted 2 lines

As fair as I can tell the weak_alias () is necessary for correct operation of mq_timedsend when external programs call it.

I wasn't commenting on the weak_alias call, but on the hidden_weak one.

Ach... indeed - sorry for misunderstanding.

Quoted 9 lines

If you have hidden_weak (mq_timedsend), you also need lib<name>_hidden_proto (mq_timedsend) in the internal header (and vice versa, hidden_proto implies you need hidden_weak).

You don't need hidden_weak (mq_timedsend) unless there is an *internal call to mq_timedsend from within the same library that defines it*.

Quoted 6 lines

Since such an internal call could just use __mq_timedsend instead, you probably don't need hidden_weak / hidden_proto for mq_timedsend.

(If you don't have an internal call to __mq_timedsend, you don't need the hidden_* for that name either.)

Thanks for the explanation.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#35 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

In reply to Lukasz Majewski
Quoted 9 lines · Lukasz Majewski
Quoted 5 lines

On Thu, Feb 20, 2020 at 10:37 AM Lukasz Majewski <[email protected]> wrote:
which seems a bug in the test suite. The other two get a segfault that I have not debugged, but I guess this is likely a problem in your patches. Have you seen the same thing?

I only do run the full (including full test suite) glibc-many-build (and my Y2038 tests) on the patches which I post to glibc-alpha.

Quoted 6 lines

The Y2038 changes I do test manually if they work as expected - but I do not run yet the (full) test suites on it, as first _all_ glibc functions needs to be converted before _TIME_BITS=64 is added.

The issue is probably with the redirection code. I will look on them soon.

Ok, thanks for taking a look, I won't debug this further then, unless you need help reproducing the issues.

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#36 lore raw

Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

In reply to Arnd Bergmann

Hi Arnd,

Quoted 6 lines · Arnd Bergmann
Quoted 6 lines
Quoted 2 lines

How do I build a latest RISCV 32-bit kernel + userland - do you have a buildroot branch somewhere that I can build / test with qemu ?

Maybe a bit off topic - there is such QEMU and Yocto/OE based test sandbox for ARM32:

Quoted 8 lines
Quoted 3 lines

https://github.com/lmajewski/meta-y2038

(the README provides steps for setup).

(continuing off-topic, with debian-arm and Helmut on Cc)

Would it be possible to take a snapshot of your glibc tree and start testing this out with debian-rebootstrap [1]?

This is exacty what rebootstrap is for. You should be able to experiment with different ABIs without committing to a particular ABI. You can fiddle with such aspects and then cross build a pile of around 120 Debian packages. That should uncover the most significant problems. You don't even have to change the GNU triplet. You can just create an incompatible throw-away port with an existing architecture name as rebootstrap refuses to reuse any existing binary packages for the host architecture.

If you want to pursue that route, get in touch with [email protected] or #debian-bootstrap on irc.oftc.net. The usual route is forking the rebootstrap.git repository. You just hack up your toolchain modifications an retry the bootstrap from scratch until you are satisfied. Be prepared to put up with half a day or a day of CPU time for a single run. Don't hesitate to ask for help if you have undecipherable build failures. Balint Reczey has done something quite similar to what you're up to: He attempted creating ports that are instrumented with sanitizers.

Since I saw arc in the subject, I also threw arc at rebootstrap. Turns out that glibc 2.30 does not yet cover arc and using unpackaged versions of glibc is non-trivial for rebootstrap, so I cannot do much about that. Once arc support is in a released version of glibc, I'd be happy to be pinged about it.

Helmut

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#37 lore raw

ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Helmut,

Quoted 6 lines · Helmut Grohne

Since I saw arc in the subject, I also threw arc at rebootstrap. Turns out that glibc 2.30 does not yet cover arc and using unpackaged versions of glibc is non-trivial for rebootstrap, so I cannot do much about that. Once arc support is in a released version of glibc, I'd be happy to be pinged about it.

ARC glibc is still in works, but assuming that will happen in near future what other upstream prerequisites are needed. The obvious ones would be Linux kernel, gcc, binutils: all 3 of which are supported for ARC. From a quick glance at debian wiki pages, I presume *bootstrap is mostly done native, so needs qemu ? (full/user emulation ? And does qemu need to be upstream too ?

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#38 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Vineet,

Quoted 5 lines · Vineet Gupta

ARC glibc is still in works, but assuming that will happen in near future what other upstream prerequisites are needed. The obvious ones would be Linux kernel, gcc, binutils: all 3 of which are supported for ARC. From a quick glance at debian wiki pages, I presume *bootstrap is mostly done native, so needs qemu ? (full/user emulation ? And does qemu need to be upstream too ?

Given that I ran into the glibc issue, I can tell that at least rudimentary arc support support is already available in Debian unstable for binutils, linux and gcc. (Otherwise, I would not have come as far as glibc.) Once glibc is in place, work can proceed on the Debian side. guile, libatomic-ops, libffi, libgpg-error and nspr ususally need a little upstream support. dpkg, gmp, openssl, and perl usually need Debian-specific changes. I'd recommend looking into libatomic-ops and libffi early. The other packages are usually simple.

The aim of rebootstrap is to create a package set for essential + build-essential using cross builds without using any qemu. Beyond that point, you'd switch to native building. Unless real hardware is available, you'd need qemu after the reboostrap phase. Whether you use full or user emulation is your choice, but I guess that you can speed up builds using user emulation, because it allows you to mix and match binaries. When you upstream your qemu is also your choice.

Please get in touch with me once a suitable glibc is packaged for Debian unstable or experimental. Please use [email protected] or irc.oftc.net #debian-bootstrap at that point. Alternatively, package a glibc locally (like Arnd did).

Helmut

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#39 lore raw

RE: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Helmut,

Quoted 7 lines · Vineet Gupta
Quoted 5 lines

ARC glibc is still in works, but assuming that will happen in near future what other upstream prerequisites are needed. The obvious ones would be Linux kernel, gcc, binutils: all 3 of which are supported for ARC. From a quick glance at debian wiki pages, I presume *bootstrap is mostly done native, so needs qemu ? (full/user emulation ? And does qemu need to be upstream too ?

Quoted 8 lines

Given that I ran into the glibc issue, I can tell that at least rudimentary arc support support is already available in Debian unstable for binutils, linux and gcc. (Otherwise, I would not have come as far as glibc.) Once glibc is in place, work can proceed on the Debian side. guile, libatomic-ops, libffi, libgpg-error and nspr ususally need a little upstream support. dpkg, gmp, openssl, and perl usually need Debian-specific changes. I'd recommend looking into libatomic-ops and libffi early. The other packages are usually simple.

I guess almost all of the packages you mentioned already have needed improvements for ARC.

1. libffi has ARC support since v3.1, see:
https://github.com/libffi/libffi/commit/b082e15091961373c03d10ed0251f619ebb6ed76

2. libgpg-error has ARC support since v1.33, see:
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=commit;h=48c8f8ddfc80

3. nspr has ARC support since v4.1, see:
https://hg.mozilla.org/projects/nspr/rev/cc73b6c7dab2e8053533e1f2c0c23dc721e10b76

And only for "libatomic-ops" & "guile" nothing has been done yet so if there's something that really needs to be done please let us know.

-Alexey

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#40 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Alexey,

Quoted 2 lines · Alexey Brodkin

I guess almost all of the packages you mentioned already have needed improvements for ARC.

I didn't mean to imply that anything was missing. I just mentioned those that usually need work without having checked any.

Quoted 2 lines

2. libgpg-error has ARC support since v1.33, see:

   http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=commit;h=48c8f8ddfc80

This is only the native-support. For rebootstrap, we also need cross build support, i.e. recording the generated lock-obj header (once glibc is done).

Quoted 2 lines

And only for "libatomic-ops" & "guile" nothing has been done yet so if there's something that really needs to be done please let us know.

I suggest that you focus on libatomic-ops then. And on glibc of course. I guess that the other issues are easily solvable when they arise.

Helmut

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#41 lore raw

RE: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Helmut,

Quoted 10 lines
Quoted 2 lines

2. libgpg-error has ARC support since v1.33, see:

   https://urldefense.proofpoint.com/v2/url?u=http-3A__git.gnupg.org_cgi-2Dbin_gitweb.cgi-3Fp-

3Dlibgpg-2Derror.git-3Ba-3Dcommit-3Bh- 3D48c8f8ddfc80&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=_zJyx Gdx_-O_dKHjFp6S-2ZXebEcmuHfmUsgpc4uEXA&s=myC306ViTlaxOV8nbOJR8pC74k2lsKmmB1hCGQR0PrE&e=

This is only the native-support. For rebootstrap, we also need cross build support, i.e. recording the generated lock-obj header (once glibc is done).

Quoted 5 lines
Quoted 2 lines

And only for "libatomic-ops" & "guile" nothing has been done yet so if there's something that really needs to be done please let us know.

I suggest that you focus on libatomic-ops then. And on glibc of course. I guess that the other issues are easily solvable when they arise.

Sorry for this stupid question but I'm not very familiar with use-cases for libatomic-ops so would like to get some more clarification on what's needed here.

I know that GCC has quite a few built-ins for atomic ops and we do implement them. I'm adding our GCC maintainer (Claudiu) in the Cc so he may jump in if needed.

-Alexey

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#42 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Alexey,

Quoted 5 lines · Alexey Brodkin

Sorry for this stupid question but I'm not very familiar with use-cases for libatomic-ops so would like to get some more clarification on what's needed here.

I know that GCC has quite a few built-ins for atomic ops and we do implement them. I'm adding our GCC maintainer (Claudiu) in the Cc so he may jump in if needed.

One part of the question here is "why do we need libatomic-ops?". The answer to that is, because libgc uses it and libgc is used by e.g. gcc, gnutls, guile, and make. Possibly, some of these could be built without libgc, but this is how they are packaged for Debian at present. Package dependencies currently say that we need libatomic-ops.

The other part is "what is missing in libatomic-ops"? If you look at a more recent implementation, such as riscv, you see that it basically says "trust gcc". So I guess all you need here is an arc-specific implementation that says "gcc knows what it is doing, use its primitives".

Given sufficient work, I guess libatomic-ops could be removed in favour of using the gcc built-ins directly. Not sure whether that'd fly with libgc upstream though.

So no, this is not a stupid question. Thank you for asking.

Helmut

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#43 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Quoted 12 lines · Helmut Grohne

One part of the question here is "why do we need libatomic-ops?". The answer to that is, because libgc uses it and libgc is used by e.g. gcc, gnutls, guile, and make. Possibly, some of these could be built without libgc, but this is how they are packaged for Debian at present. Package dependencies currently say that we need libatomic-ops.

The other part is "what is missing in libatomic-ops"? If you look at a more recent implementation, such as riscv, you see that it basically says "trust gcc". So I guess all you need here is an arc-specific implementation that says "gcc knows what it is doing, use its primitives".

Quoted 5 lines

Given sufficient work, I guess libatomic-ops could be removed in favour of using the gcc built-ins directly. Not sure whether that'd fly with libgc upstream though.

So no, this is not a stupid question. Thank you for asking.

The way I read the details on libatomic is that it provides functions to implement the things a given architecture can't do with intrinsics in gcc directly. So on some architectures it does nothing and on others it implements missing bits for atomic operations.

Signature · 6 lines
Len Sorensen

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#44 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

In reply to Helmut Grohne

Hi,

Quoted 25 lines · Helmut Grohne

Hi Vineet,

Quoted 5 lines · Vineet Gupta

ARC glibc is still in works, but assuming that will happen in near future what other upstream prerequisites are needed. The obvious ones would be Linux kernel, gcc, binutils: all 3 of which are supported for ARC. From a quick glance at debian wiki pages, I presume *bootstrap is mostly done native, so needs qemu ? (full/user emulation ? And does qemu need to be upstream too ?

Given that I ran into the glibc issue, I can tell that at least rudimentary arc support support is already available in Debian unstable for binutils, linux and gcc. (Otherwise, I would not have come as far as glibc.) Once glibc is in place, work can proceed on the Debian side. guile, libatomic-ops, libffi, libgpg-error and nspr ususally need a little upstream support. dpkg, gmp, openssl, and perl usually need Debian-specific changes. I'd recommend looking into libatomic-ops and libffi early. The other packages are usually simple.

The aim of rebootstrap is to create a package set for essential + build-essential using cross builds without using any qemu. Beyond that point, you'd switch to native building. Unless real hardware is available, you'd need qemu after the reboostrap phase. Whether you use full or user emulation is your choice, but I guess that you can speed up builds using user emulation, because it allows you to mix and match binaries. When you upstream your qemu is also your choice.

Quoted 4 lines

Please get in touch with me once a suitable glibc is packaged for Debian unstable or experimental. Please use [email protected] or irc.oftc.net #debian-bootstrap at that point. Alternatively, package a glibc locally (like Arnd did).

Following up as ARC glibc port was merged upstream in 2.32. Can we now give rebootstrap a spin for ARC Debian enablement.

Thx,
-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#45 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Vineet,

Quoted 2 lines · Vineet Gupta

Following up as ARC glibc port was merged upstream in 2.32. Can we now give rebootstrap a spin for ARC Debian enablement.

That's great news. Unfortunately, it's not that easy yet. rebootstrap requires the relevant software to be packaged for Debian and the glibc packaging has only reached 2.31 yet. 2.32 is not even in experimental yet.

Trying rebootstrap with an experimental glibc is not entirely trivial, but possible.

Aurelien (Cced via [email protected]), are there plans to upload 2.32 to experimental anytime soon?

Alternatively, can we segregate the relevant diff between 2.31 and 2.32 and apply it to the unstable package without bumping the version?

Helmut

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#46 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Helmut,

Quoted 11 lines · Helmut Grohne

Hi Vineet,

Quoted 2 lines · Vineet Gupta

Following up as ARC glibc port was merged upstream in 2.32. Can we now give rebootstrap a spin for ARC Debian enablement.

That's great news. Unfortunately, it's not that easy yet. rebootstrap requires the relevant software to be packaged for Debian and the glibc packaging has only reached 2.31 yet. 2.32 is not even in experimental yet.

Quoted 5 lines

Trying rebootstrap with an experimental glibc is not entirely trivial, but possible.

Aurelien (Cced via [email protected]), are there plans to upload 2.32 to experimental anytime soon?

No it's not planned soon. glibc 2.32 has removed support for nsl and rpc, so we first have to do the transition to their replacement. That is libnsl, libnss-nis and libnss-nisplus for nsl, and rpcsvc-proto and libtirpc3 for rpc. The nsl transition is in good state, but the packages are stuck in NEW. We've started to work on the rpc transition, however there is a lot more work, we have at least ~50 packages that FTBFS and need to be manually patched to use libtirpc3 instead of the glibc implementation.

We definitely need to use experimental to test those two transitions and ask for archive rebuilds, so it's not possible to upload a 2.32 package there.

Quoted 2 lines

Alternatively, can we segregate the relevant diff between 2.31 and 2.32 and apply it to the unstable package without bumping the version?

I don't think that's really possible, new ports introduced in version 2.32 will have all the symbol versions set to GLIBC_2.32.

Regards,
Aurelien

PS Helmut: Once libnsl, libnss-nis and libnss-nisplus are out of NEW, you might want to see if they can be cross-built, and if that impacts the bootstrap process as the glibc packages are going to depend on those (in the same way as for the libxcrypt transition).

Signature · 7 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#47 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Helmut, Aurelien

Quoted 36 lines · Aurelien Jarno

Hi Helmut,

Quoted 10 lines · Helmut Grohne

Hi Vineet,

Quoted 2 lines · Vineet Gupta

Following up as ARC glibc port was merged upstream in 2.32. Can we now give rebootstrap a spin for ARC Debian enablement.

That's great news. Unfortunately, it's not that easy yet. rebootstrap requires the relevant software to be packaged for Debian and the glibc packaging has only reached 2.31 yet. 2.32 is not even in experimental yet.

Quoted 5 lines

Trying rebootstrap with an experimental glibc is not entirely trivial, but possible.

Aurelien (Cced via [email protected]), are there plans to upload 2.32 to experimental anytime soon?

No it's not planned soon. glibc 2.32 has removed support for nsl and rpc, so we first have to do the transition to their replacement. That is libnsl, libnss-nis and libnss-nisplus for nsl, and rpcsvc-proto and libtirpc3 for rpc. The nsl transition is in good state, but the packages are stuck in NEW. We've started to work on the rpc transition, however there is a lot more work, we have at least ~50 packages that FTBFS and need to be manually patched to use libtirpc3 instead of the glibc implementation.

We definitely need to use experimental to test those two transitions and ask for archive rebuilds, so it's not possible to upload a 2.32 package there.

Quoted 2 lines

Alternatively, can we segregate the relevant diff between 2.31 and 2.32 and apply it to the unstable package without bumping the version?

I don't think that's really possible, new ports introduced in version 2.32 will have all the symbol versions set to GLIBC_2.32.

Quoted 8 lines

Regards,
Aurelien

PS Helmut: Once libnsl, libnss-nis and libnss-nisplus are out of NEW, you might want to see if they can be cross-built, and if that impacts the bootstrap process as the glibc packages are going to depend on those (in the same way as for the libxcrypt transition).

Checking in to see if things have change since my last posting on this topic.
Is glibc 2.32 now packaged for debian so we can attempt ARC rebootstrap ?

Thx,
-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#48 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Vineet,

Quoted 2 lines · Vineet Gupta

Checking in to see if things have change since my last posting on this topic.

Appreciated. I would have forgotten about arc.

Quoted 1 line

Is glibc 2.32 now packaged for debian so we can attempt ARC rebootstrap ?

Unfortunately, no. Debian has started freezing in preparating of the bullseye release. Only up to version 2.31 is packaged and Aurelien seems a little busy these days. If I recall correctly, 2.32 drops some backwards compatibility stuff that Debian still relies on $somewhere, but is transitioning away already. So it's not just dumping 2.32 together with the 2.31 packaging in experimental.

Before that happens, there is little I can do to help. With 2.31, we still get:
| checking sysdep dirs... configure: error: The arc is not supported. I'm still interested in supporting the arc bootstrap. Please get back with me when we can move on.

You can check Debian's glibc version at
https://tracker.debian.org/pkg/glibc at any time in the version column.

Helmut

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#49 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

Hi Helmut,

Quoted 6 lines · Helmut Grohne

Unfortunately, no. Debian has started freezing in preparating of the bullseye release. Only up to version 2.31 is packaged and Aurelien seems a little busy these days. If I recall correctly, 2.32 drops some backwards compatibility stuff that Debian still relies on $somewhere, but is transitioning away already.

2.32 also brings in 64-bit time_t/offset support (at least the ARC ABI is) so there might be even more work in rest of ecosystem.

Quoted 6 lines

So it's not just dumping 2.32
together with the 2.31 packaging in experimental.

Before that happens, there is little I can do to help. With 2.31, we still get:
| checking sysdep dirs... configure: error: The arc is not supported.

At one point you were contemplating diff'ing between glibc 2.31 and 2.32 and trying to apply that to unstable package w/o bumping the version. But how about we take 2.31 as baseline and use the prio ARC port (same 32-bit time_t ABI) to kick things forward if just as a hack. We would then be able to shake out any other potential downstream blockers)

Quoted 2 lines

I'm still interested in supporting the arc bootstrap. Please get back with me when we can move on.

Thx, that is appreciated.

Quoted 2 lines

You can check Debian's glibc version at
https://tracker.debian.org/pkg/glibc at any time in the version column.

Noted.

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#50 lore raw

Re: ARC rebootstrap prereq (was Re: switching ARC to 64-bit time_t )

In reply to Aurelien Jarno

Hi,

Quoted 29 lines · Aurelien Jarno

Hi Helmut,

Quoted 11 lines · Helmut Grohne

Hi Vineet,

Quoted 2 lines · Vineet Gupta

Following up as ARC glibc port was merged upstream in 2.32. Can we now give rebootstrap a spin for ARC Debian enablement.

That's great news. Unfortunately, it's not that easy yet. rebootstrap requires the relevant software to be packaged for Debian and the glibc packaging has only reached 2.31 yet. 2.32 is not even in experimental yet.

Quoted 5 lines

Trying rebootstrap with an experimental glibc is not entirely trivial, but possible.

Aurelien (Cced via [email protected]), are there plans to upload 2.32 to experimental anytime soon?

No it's not planned soon. glibc 2.32 has removed support for nsl and rpc, so we first have to do the transition to their replacement. That is libnsl, libnss-nis and libnss-nisplus for nsl, and rpcsvc-proto and libtirpc3 for rpc. The nsl transition is in good state, but the packages are stuck in NEW. We've started to work on the rpc transition, however there is a lot more work, we have at least ~50 packages that FTBFS and need to be manually patched to use libtirpc3 instead of the glibc implementation.

Quoted 4 lines

We definitely need to use experimental to test those two transitions and ask for archive rebuilds, so it's not possible to upload a 2.32 package there.

Now that the RPC transition is ongoing, I have just uploaded glibc 2.32 to experimental.

Regards,
Aurelien

Signature · 7 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#51 lore raw
In reply to Alistair Francis
Quoted 10 lines · Alistair Francis
Quoted 7 lines · Vineet Gupta

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 5 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +0 -0
new file mode 100644
index 0000000000..0da3bdeb5d

I was hoping newer arches could simply use the asm-generic one ?

Quoted 2 lines

We need to specify that RV32 uses a 64-bit time_t. The generic ones don't do that for 32-bit arches.

Right. It pains to see that each new port (despite using asm-generic syscall ABI) will have to make their own copy of something so fundamental as typesizes.h where only a few things will change. The generic file is no longer generic :-( Oh well !

Quoted 10 lines
Quoted 10 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 4 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +4 -0
+/* 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

This is orthogonal to time_t but since we are on topic of newer ports, how are you doing this. The asm-generic uapi defines

        typedef __kernel_long_t __kernel_off_t;
Quoted 8 lines
Quoted 5 lines

and types.h defines

        typedef __kernel_off_t off_t;

And I presume long on RV32 is 32-bits

Can you point me to the code? Last time I looked the kernel used the 64-bit versions for the syscalls on RV32.

You are right. I got confused with the types above: asm-generic syscalls on 32-bit arches use struct stat64 etc which has 64-bit inode. Similarly sys_llseek uses low/high parts for offset.

Quoted 2 lines
Quoted 2 lines

sysdeps/unix/sysv/linux/riscv/bits/typesizes.h

Quoted 2 lines
sysdeps/unix/sysv/linux/riscv/bits/typesizes.h new file +2 -0
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T 1

I'm surprised that ARC port doesn't define this in glibc, yet we use the asm-generic syscall interface where this is true. I need to investigate more.

Thx,
-vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#52 lore raw
Quoted 8 lines · Vineet Gupta
Quoted 4 lines · Alistair Francis
Quoted 2 lines · Vineet Gupta

Review

Quoted 2 lines
(quoted diff) +2 -0
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T 1

I'm surprised that ARC port doesn't define this in glibc, yet we use the asm-generic syscall interface where this is true. I need to investigate more.

All 32-bit kernels supported by glibc today define the 64-bit file offset types (__off64_t, __ino64_t, ...) and a lot of them never had the old 'long' types (__off_t, __ino_t, ...), but applications can still pick between the two ABIs when compiling against glibc, see /usr/include/fcntl.h:

#ifndef __off_t_defined

# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
# else
typedef __off64_t off_t;
# endif
# define __off_t_defined
#endif

If you use the old types, glibc will do the conversion in the syscall wrappers on architectures that only have the 64-bit interfaces.

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#53 lore raw
In reply to a message not in the archive

Hi Alistair,

sysdeps/unix/sysv/linux/riscv/kernel_stat.h

Quoted 1 line · Alistair Francis
sysdeps/unix/sysv/linux/riscv/kernel_stat.h +0 -0

[snip]...

Quoted 1 line

+#define STAT_IS_KERNEL_STAT 1

Isn't this irrelevant: seems to be only used for legacy __NR_stat/__NR_stat64 syscalls based__xstat()/__xstat64().

sysdeps/unix/sysv/linux/riscv/kernel_stat.h

Quoted 4 lines
sysdeps/unix/sysv/linux/riscv/kernel_stat.h +3 -0
+
+#define XSTAT_IS_XSTAT64 1
+#define STATFS_IS_STATFS64 0

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#54 lore raw
Quoted 4 lines · Vineet Gupta

Hi Alistair,

On 1/12/20 2:33 AM, Alistair Francis wrote:

Quoted 8 lines

sysdeps/unix/sysv/linux/riscv/kernel_stat.h

Quoted 1 line
sysdeps/unix/sysv/linux/riscv/kernel_stat.h +0 -0

[snip]...

Quoted 1 line

+#define STAT_IS_KERNEL_STAT 1

Isn't this irrelevant: seems to be only used for legacy __NR_stat/__NR_stat64 syscalls based__xstat()/__xstat64().

Is it? It seems to be used in a few places, including:

sysdeps/unix/sysv/linux/fxstatat.c
sysdeps/unix/sysv/linux/xstatconv.c

Alistair

Quoted 6 lines

sysdeps/unix/sysv/linux/riscv/kernel_stat.h

Quoted 5 lines
sysdeps/unix/sysv/linux/riscv/kernel_stat.h +3 -0
+
+#define XSTAT_IS_XSTAT64 1
+#define STATFS_IS_STATFS64 0

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#55 lore raw
Quoted 7 lines · Alistair Francis
Quoted 3 lines
Quoted 1 line

+#define STAT_IS_KERNEL_STAT 1

Isn't this irrelevant: seems to be only used for legacy __NR_stat/__NR_stat64 syscalls based__xstat()/__xstat64().

Is it? It seems to be used in a few places, including:

sysdeps/unix/sysv/linux/fxstatat.c
sysdeps/unix/sysv/linux/xstatconv.c

AFAIK that is not part of the asm-generic syscall ABI which ARC, RISCV et al use !

-Vineet
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#56 lore raw
Quoted 10 lines · Vineet Gupta
Quoted 7 lines · Alistair Francis
Quoted 3 lines
Quoted 1 line

+#define STAT_IS_KERNEL_STAT 1

Isn't this irrelevant: seems to be only used for legacy __NR_stat/__NR_stat64 syscalls based__xstat()/__xstat64().

Is it? It seems to be used in a few places, including:

sysdeps/unix/sysv/linux/fxstatat.c
sysdeps/unix/sysv/linux/xstatconv.c

AFAIK that is not part of the asm-generic syscall ABI which ARC, RISCV et al use !

The latter is still included by everyone, though.

Andreas.

Signature · 8 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#57 lore raw
Quoted 6 lines · Andreas Schwab
Quoted 4 lines · Vineet Gupta
Quoted 3 lines · Alistair Francis
Quoted 3 lines
Quoted 1 line

+#define STAT_IS_KERNEL_STAT 1

Isn't this irrelevant: seems to be only used for legacy __NR_stat/__NR_stat64 syscalls based__xstat()/__xstat64().

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

Is it? It seems to be used in a few places, including:

sysdeps/unix/sysv/linux/fxstatat.c
sysdeps/unix/sysv/linux/xstatconv.c

AFAIK that is not part of the asm-generic syscall ABI which ARC, RISCV et al use !

The latter is still included by everyone, though.

Correct, although it only builds a "dummy" struct for #ifdef STAT_IS_KERNEL_STAT i.e. for either values of this define - we might as well move that dummy out and make the rest of code ifndef.

Rest of code in that function __xstat_conv is not meant for asm-generic syscall ABI anyways.

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#58 lore raw

Hi Vineet,

Quoted 14 lines · Andreas Schwab
Quoted 13 lines · Vineet Gupta
Quoted 11 lines · Alistair Francis
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+#define STAT_IS_KERNEL_STAT 1

Isn't this irrelevant: seems to be only used for legacy __NR_stat/__NR_stat64 syscalls based__xstat()/__xstat64().

Is it? It seems to be used in a few places, including:

sysdeps/unix/sysv/linux/fxstatat.c
sysdeps/unix/sysv/linux/xstatconv.c

AFAIK that is not part of the asm-generic syscall ABI which ARC, RISCV et al use !

Quoted 8 lines
Quoted 1 line

The latter is still included by everyone, though.

Correct, although it only builds a "dummy" struct for #ifdef STAT_IS_KERNEL_STAT i.e. for either values of this define - we might as well move that dummy out and make the rest of code ifndef.

Rest of code in that function __xstat_conv is not meant for asm-generic syscall ABI anyways.

Please keep in mind that there are some architectures (like 32 bit ARM), which are NOT using asm-generic API.

Those archs also require support for 64 bit time. That is why Alistair put the [sg]etitimer conversion code into sysdeps/unix/sysv/linux/ directory.

In that way all eligible archs could reuse the same conversion code.

Quoted 4 lines

Thx,
-Vineet

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#59 lore raw

Hi Lukasz,

Quoted 2 lines · Lukasz Majewski

Please keep in mind that there are some architectures (like 32 bit ARM), which are NOT using asm-generic API.

Right understand that.

Quoted 5 lines

Those archs also require support for 64 bit time. That is why Alistair put the [sg]etitimer conversion code into sysdeps/unix/sysv/linux/ directory.

In that way all eligible archs could reuse the same conversion code.

Do note that the statx syscall to glibc stat64 interworking is already usable for both cases as it is in sysdeps/unix/sysv/linux/statx_cp.*

Is see that for ARM32, following files are built:

sysdeps/unix/sysv/linux/arm/xstat.c
sysdeps/unix/sysv/linux/arm/fxstat.c
sysdeps/unix/sysv/linux/arm/lxstat.c
sysdeps/unix/sysv/linux/arm/fxstatat.c

sysdeps/unix/sysv/linux/xstat64.c
sysdeps/unix/sysv/linux/fxstat64.c
sysdeps/unix/sysv/linux/lxstat64.c
sysdeps/unix/sysv/linux/fxstatat64.c

My patch will switch the last 4 for ARM as well.

The first 4 will need more work as sym aliasing like

	strong_alias (__xstat64, __xstat)

will be needed in those ARM files (which in turn use i386).

Anyhow, let me test my patch and then we can take it from there !

Thx,
-Vineet

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#60 lore raw
Quoted 4 lines · Vineet Gupta

The first 4 will need more work as sym aliasing like

	strong_alias (__xstat64, __xstat)

will be needed in those ARM files (which in turn use i386).

The situation for Arm is fundamentally different from that for ARC.

For ARC, you only need a single public stat structure (using 64-bit times and offsets).

For Arm, a third public stat structure will need to be added alongside the existing two, initially used internally in 64-bit-time stat functions that aren't exported from glibc, eventually to be used with _TIME_BITS=64 with the 64-bit-time stat interfaces exported once all the _TIME_BITS=64 interfaces are ready.

Signature · 7 lines
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
#61 lore raw
Quoted 10 lines · Joseph Myers
Quoted 4 lines · Vineet Gupta

The first 4 will need more work as sym aliasing like

      strong_alias (__xstat64, __xstat)

will be needed in those ARM files (which in turn use i386).

The situation for Arm is fundamentally different from that for ARC.

Quoted 8 lines

For ARC, you only need a single public stat structure (using 64-bit times and offsets).

For Arm, a third public stat structure will need to be added alongside the existing two, initially used internally in 64-bit-time stat functions that aren't exported from glibc, eventually to be used with _TIME_BITS=64 with the 64-bit-time stat interfaces exported once all the _TIME_BITS=64 interfaces are ready.

But surely that structure layout would be the same on ARM and ARC as well as all other 32-bit architectures with _TIME_BITS=64, right?

What's wrong with having a single implementation for the most recent set of stat syscalls, with the older variants being only compiled for architectures that need them to support _TIME_BITS=32 and/or _FILE_OFFSET_BITS=32?

Arnd

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#62 lore raw

Hi Arnd, Joseph,

Quoted 22 lines
Quoted 13 lines · Joseph Myers
Quoted 4 lines · Vineet Gupta

The first 4 will need more work as sym aliasing like

      strong_alias (__xstat64, __xstat)

will be needed in those ARM files (which in turn use i386).

The situation for Arm is fundamentally different from that for ARC.

For ARC, you only need a single public stat structure (using 64-bit times and offsets).

Quoted 6 lines

For Arm, a third public stat structure will need to be added alongside the existing two, initially used internally in 64-bit-time stat functions that aren't exported from glibc, eventually to be used with _TIME_BITS=64 with the 64-bit-time stat interfaces exported once all the _TIME_BITS=64 interfaces are ready.

Quoted 3 lines

But surely that structure layout would be the same on ARM and ARC as well as all other 32-bit architectures with _TIME_BITS=64, right?

For ARM32 stat case (current):

./io/stat.c -> __xstat -> ./sysdeps/unix/sysv/linux/xstat64.c and then struct stat64 buf is filled by the kernel.

The generic idea (which requires converting ./sysdeps/unix/sysv/linux/xstat64.c) would be to use statx always in glibc instead of stat* syscalls (as it is done in sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c)

To do that we do need in-glibc internal new type - namely struct stat64_time64

which would have always:

__time64_t st_atime; (and st_mtime, st_ctime).

instead of

__time_t st_atime;

and also introduce __cp_stat64_time64_statx along with __cp_stat64_statx

as struct statx inherently support 64 bit time via struct statx_timestamp even on 32 bit archs.

IMHO using statx as widely as possible in glibc is the easiest way to convert stat* and friends functions to support Y2038.

Quoted 6 lines

What's wrong with having a single implementation for the most recent set of stat syscalls, with the older variants being only compiled for architectures that need them to support _TIME_BITS=32 and/or _FILE_OFFSET_BITS=32?

Arnd

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#63 lore raw
In reply to Arnd Bergmann
Quoted 2 lines · Arnd Bergmann

But surely that structure layout would be the same on ARM and ARC as well as all other 32-bit architectures with _TIME_BITS=64, right?

Yes.

Quoted 4 lines

What's wrong with having a single implementation for the most recent set of stat syscalls, with the older variants being only compiled for architectures that need them to support _TIME_BITS=32 and/or _FILE_OFFSET_BITS=32?

The ARC case should be a very simple patch, just changing a few conditionals so the statx path can be used on an architecture that also has the old syscalls. No conditionals for whether to build a particular stat function, or for what that function is called, will be needed. No conditionals for whether a syscall is available at runtime will be needed, because at least initially the port will be assuming Linux 5.1 or later.

In the Arm case, the code will need to allow for runtime fallback to old stat syscalls on kernels without statx, and will need to build the function using the new layout under a new name. That's a much more complicated change that can build on top of the ARC change.

Signature · 7 lines
Joseph S. Myers
[email protected]

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc