public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC v4 00/24]  RISC-V glibc port for the 32-bit
@ 2019-08-10  1:03 Alistair Francis
  2019-08-10  1:03 ` [RFC v4 13/24] RISC-V: Use 64-bit timespec in clock_gettime vdso calls Alistair Francis
                   ` (23 more replies)
  0 siblings, 24 replies; 73+ messages in thread
From: Alistair Francis @ 2019-08-10  1:03 UTC (permalink / raw)
  To: libc-alpha
  Cc: arnd, adhemerval.zanella, fweimer, palmer, macro, zongbox,
	alistair.francis, alistair23

This patch set contains the glibc port for the 32-bit RISC-V.

This is based on all of the work that Zong Li has done [1].

Unfortunately the Linux ABI has changed since Zong Li's latest
submission. The RISC-V 32-bit (RV32) ABI no longer defines
__ARCH_WANT_TIME32_SYSCALLS which means there are no 32-bit versions of
time_t, off_t or any struct resource or system calls that use them.

To mitigate this I have set the RV32 port to use 64-bit time_t and off_t
(as is done in x86-32) and also changed the syscall imvocation to handle
the missing syscalls. This means that the RV32 port will be y2038 safe.

This series applies ontop of Lukasz's __clock_settime64 implementation [2].

The ChangeLog will need to be updated, so don't worry too much
about that.

The waitid() call can result in a race condition. We are waiting for
kernel patches to allow passing a pid of 0 in [3]. This will need to be
updated once the kernel patches have landed.

The last two patches change the syscalls.list file. I'm not clear on the
correct way to handle this change. I would like to get some feedback on
what I should do here.

All testing has been done on a 5.1+ kernel (it won't work on earlier
kernels). I still haven't been able to reliably run the tests, so no
test results yet. I should have those when I send the first patch
series.

Importantly glibc is not the only project that needs to be updated to
work with a 32-bit kernel that doesn't define
__ARCH_WANT_TIME32_SYSCALLS. So far OpenSSL, busybox and systemd all
need patches to work with RV32. My hope here is that we can get a
reasonable agreement on how to handle this in glibc and then use that to
update other projects. This is why I would still really like feedback
even though this won't go into the next release.

Feedback on this series is very welcome!

1: https://sourceware.org/ml/libc-alpha/2018-07/msg00892.html
2: https://sourceware.org/ml/libc-alpha/2019-05/msg00661.html
3: https://sourceware.org/ml/libc-alpha/2019-07/msg00489.html

The latest version of my work can be found here: https://github.com/alistair23/glibc/tree/alistair/rv32.next

This specific version can be found here: https://github.com/alistair23/glibc/tree/alistair/rv32.rfc4

RFC v4:
 - Continue to fix things that weren't working
 - Update the coding style to match glibc
 - Update the __ASSUME_TIME64_SYSCALLS work to better match Lukasz's
 work
RFC v3:
 - Remove all "Hack" patches
 - Incorporate upstream comments
 - Ensure we don't break RV64
 - Lot's more testing and fixes
RFC v2:
 - Add Lukasz's patches
 - Update the non HACK syscalls after feedback
 - define __ASSUME_TIME64_SYSCALLS and __ASSUME_RLIM64_SYSCALLS
 - Remove lockf64.c
 - Other smaller changes from RFC v1



Alistair Francis (15):
  sunrpc/clnt_udp: Ensure total_deadline is initalised
  sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable
  sysdeps/gettimeofday: Use clock_gettime64 if avaliable
  sysdeps/wait: Use waitid if avaliable
  sysdeps/clock_gettime: Use clock_gettime64 if avaliable
  sysdeps/timespec_get: Use clock_gettime64 if avaliable
  time: Deprecate struct timezone members
  sysdeps/stat: Copy the statx struct to stat instead of stat64
  RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
  RISC-V: define __NR_futex as __NR_futex_time64 for 32-bit
  RISC-V: define __NR_* as __NR_*_time64/64 for 32-bit
  RISC-V: Use 64-bit timespec in clock_gettime vdso calls
  RISC-V: Use 64-bit vdso syscalls for RV32
  WIP: syscall.list: Call 64-bit versions of syscalls
  timerfd_settime: Use 64-bit call if avaliable

Zong Li (9):
  Documentation for the RISC-V 32-bit port
  RISC-V: Support dynamic loader for the 32-bit
  RISC-V: Add path of library directories for RV32
  RISC-V: The ABI implementation for the 32-bit
  RISC-V: Hard float support for the 32 bit
  RISC-V: Add ABI lists
  RISC-V: Build Infastructure for the 32-bit
  RISC-V: Fix llrint and llround missing exceptions on RV32
  Add RISC-V 32-bit target to build-many-glibcs.py

 ChangeLog                                     |   94 +
 NEWS                                          |    6 +
 README                                        |    1 +
 nptl/thrd_sleep.c                             |   60 +-
 scripts/build-many-glibcs.py                  |   15 +
 sunrpc/clnt_udp.c                             |    2 +-
 sysdeps/riscv/bits/wordsize.h                 |    4 +-
 sysdeps/riscv/nptl/bits/pthreadtypes-arch.h   |   25 +-
 sysdeps/riscv/preconfigure                    |    6 +-
 sysdeps/riscv/rv32/Implies-after              |    1 +
 .../riscv/rv32/fix-fp-int-convert-overflow.h  |   38 +
 sysdeps/riscv/rv32/rvd/Implies                |    3 +
 sysdeps/riscv/rv32/rvd/s_lrint.c              |   31 +
 sysdeps/riscv/rv32/rvd/s_lround.c             |   31 +
 sysdeps/riscv/rv32/rvf/Implies                |    1 +
 sysdeps/riscv/rv32/rvf/s_lrintf.c             |   31 +
 sysdeps/riscv/rv32/rvf/s_lroundf.c            |   31 +
 sysdeps/riscv/sfp-machine.h                   |   27 +-
 sysdeps/riscv/sys/asm.h                       |    5 +-
 sysdeps/unix/bsd/ftime.c                      |    4 +-
 sysdeps/unix/sysv/linux/Makefile              |    2 +
 sysdeps/unix/sysv/linux/clock_getres.c        |    4 +
 sysdeps/unix/sysv/linux/clock_gettime.c       |   62 +-
 sysdeps/unix/sysv/linux/clock_nanosleep.c     |   61 +-
 .../sysv/linux/generic/wordsize-32/fxstat.c   |    2 +-
 .../sysv/linux/generic/wordsize-32/fxstatat.c |    2 +-
 .../sysv/linux/generic/wordsize-32/lxstat.c   |    2 +-
 .../sysv/linux/generic/wordsize-32/xstat.c    |    2 +-
 sysdeps/unix/sysv/linux/gettimeofday.c        |   51 +
 sysdeps/unix/sysv/linux/nanosleep.c           |   75 +
 sysdeps/unix/sysv/linux/nanosleep_nocancel.c  |   47 +
 sysdeps/unix/sysv/linux/riscv/Makefile        |    4 +-
 .../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    |   84 +
 sysdeps/unix/sysv/linux/riscv/configure       |   39 +
 sysdeps/unix/sysv/linux/riscv/configure.ac    |    8 +
 sysdeps/unix/sysv/linux/riscv/dl-cache.h      |   17 +-
 sysdeps/unix/sysv/linux/riscv/init-first.c    |   24 +-
 sysdeps/unix/sysv/linux/riscv/ldconfig.h      |    2 +-
 sysdeps/unix/sysv/linux/riscv/libc-vdso.h     |   10 +-
 sysdeps/unix/sysv/linux/riscv/rv32/Implies    |    3 +
 .../unix/sysv/linux/riscv/rv32/c++-types.data |   67 +
 .../sysv/linux/riscv/rv32/jmp_buf-macros.h    |   53 +
 sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist |    9 +
 .../linux/riscv/rv32/libBrokenLocale.abilist  |    1 +
 .../unix/sysv/linux/riscv/rv32/libanl.abilist |    4 +
 .../unix/sysv/linux/riscv/rv32/libc.abilist   | 2101 +++++++++++++++++
 .../sysv/linux/riscv/rv32/libcrypt.abilist    |    2 +
 .../unix/sysv/linux/riscv/rv32/libdl.abilist  |    9 +
 .../unix/sysv/linux/riscv/rv32/libm.abilist   | 1021 ++++++++
 .../sysv/linux/riscv/rv32/libpthread.abilist  |  235 ++
 .../sysv/linux/riscv/rv32/libresolv.abilist   |   79 +
 .../unix/sysv/linux/riscv/rv32/librt.abilist  |   35 +
 .../linux/riscv/rv32/libthread_db.abilist     |   40 +
 .../sysv/linux/riscv/rv32/libutil.abilist     |    6 +
 sysdeps/unix/sysv/linux/riscv/shlib-versions  |   10 +-
 sysdeps/unix/sysv/linux/riscv/sysdep.h        |   57 +
 sysdeps/unix/sysv/linux/statx_cp.c            |   24 +
 sysdeps/unix/sysv/linux/statx_cp.h            |    3 +
 sysdeps/unix/sysv/linux/sys/timerfd.h         |   21 +-
 sysdeps/unix/sysv/linux/syscalls.list         |    7 +-
 sysdeps/unix/sysv/linux/timerfd_settime.c     |  104 +
 sysdeps/unix/sysv/linux/timespec_get.c        |   56 +-
 sysdeps/unix/sysv/linux/wait.c                |   41 +-
 sysdeps/unix/sysv/linux/waitpid.c             |   58 +-
 sysdeps/unix/sysv/linux/waitpid_nocancel.c    |   55 +-
 time/sys/time.h                               |    4 +-
 69 files changed, 5106 insertions(+), 56 deletions(-)
 create mode 100644 sysdeps/riscv/rv32/Implies-after
 create mode 100644 sysdeps/riscv/rv32/fix-fp-int-convert-overflow.h
 create mode 100644 sysdeps/riscv/rv32/rvd/Implies
 create mode 100644 sysdeps/riscv/rv32/rvd/s_lrint.c
 create mode 100644 sysdeps/riscv/rv32/rvd/s_lround.c
 create mode 100644 sysdeps/riscv/rv32/rvf/Implies
 create mode 100644 sysdeps/riscv/rv32/rvf/s_lrintf.c
 create mode 100644 sysdeps/riscv/rv32/rvf/s_lroundf.c
 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/rv32/Implies
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libBrokenLocale.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libanl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libcrypt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libdl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libresolv.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/librt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libthread_db.abilist
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/libutil.abilist
 create mode 100644 sysdeps/unix/sysv/linux/timerfd_settime.c

-- 
2.22.0

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

end of thread, other threads:[~2019-08-20 20:11 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-10  1:03 [RFC v4 00/24] RISC-V glibc port for the 32-bit Alistair Francis
2019-08-10  1:03 ` [RFC v4 13/24] RISC-V: Use 64-bit timespec in clock_gettime vdso calls Alistair Francis
2019-08-10  1:03 ` [RFC v4 15/24] RISC-V: Add path of library directories for RV32 Alistair Francis
2019-08-10  1:03 ` [RFC v4 17/24] RISC-V: Hard float support for the 32 bit Alistair Francis
2019-08-10  1:03 ` [RFC v4 12/24] RISC-V: define __NR_* as __NR_*_time64/64 for 32-bit Alistair Francis
2019-08-10  1:03 ` [RFC v4 07/24] time: Deprecate struct timezone members Alistair Francis
2019-08-10  1:20   ` Paul Eggert
2019-08-10  1:30     ` Alistair Francis
2019-08-11 13:52       ` Florian Weimer
2019-08-11 16:59         ` Alistair Francis
2019-08-11 17:28         ` Rich Felker
2019-08-12  8:22           ` Florian Weimer
2019-08-12 15:42   ` Zack Weinberg
2019-08-12 20:20     ` Joseph Myers
2019-08-12 21:08       ` Zack Weinberg
2019-08-12 21:26         ` Joseph Myers
2019-08-12 22:13           ` Alistair Francis
2019-08-12 23:16           ` Zack Weinberg
2019-08-13  0:53           ` Paul Eggert
2019-08-13  1:04             ` Zack Weinberg
2019-08-12 22:11     ` Alistair Francis
2019-08-10  1:03 ` [RFC v4 05/24] sysdeps/clock_gettime: Use clock_gettime64 if avaliable Alistair Francis
2019-08-12 19:46   ` Joseph Myers
2019-08-13 23:48     ` Alistair Francis
2019-08-14 16:37       ` Joseph Myers
2019-08-14 18:12         ` Alistair Francis
2019-08-10  1:03 ` [RFC v4 02/24] sysdeps/nanosleep: Use clock_nanosleep_time64 " Alistair Francis
2019-08-12 17:22   ` Joseph Myers
2019-08-14 18:24     ` Alistair Francis
2019-08-14 20:15       ` Joseph Myers
2019-08-14 21:39       ` Stepan Golosunov
2019-08-10  1:03 ` [RFC v4 03/24] sysdeps/gettimeofday: Use clock_gettime64 " Alistair Francis
2019-08-12 17:27   ` Joseph Myers
2019-08-10  1:03 ` [RFC v4 01/24] sunrpc/clnt_udp: Ensure total_deadline is initalised Alistair Francis
2019-08-10  1:03 ` [RFC v4 06/24] sysdeps/timespec_get: Use clock_gettime64 if avaliable Alistair Francis
2019-08-12 19:46   ` Joseph Myers
2019-08-15 18:03     ` Alistair Francis
2019-08-15 19:46       ` Joseph Myers
2019-08-15 20:52         ` Alistair Francis
2019-08-15 20:59           ` Joseph Myers
2019-08-15 21:16             ` Alistair Francis
2019-08-15 21:19               ` Joseph Myers
2019-08-15 21:23                 ` Alistair Francis
2019-08-15 21:28                   ` Joseph Myers
2019-08-15 21:35                     ` Alistair Francis
2019-08-10  1:03 ` [RFC v4 04/24] sysdeps/wait: Use waitid " Alistair Francis
2019-08-10  1:03 ` [RFC v4 10/24] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64 Alistair Francis
2019-08-10  1:03 ` [RFC v4 08/24] sysdeps/stat: Copy the statx struct to stat instead of stat64 Alistair Francis
2019-08-12 20:01   ` Joseph Myers
2019-08-12 22:26     ` Alistair Francis
2019-08-12 23:02       ` Joseph Myers
2019-08-12 23:10         ` Alistair Francis
2019-08-12 23:31           ` Joseph Myers
2019-08-13 20:40             ` Alistair Francis
2019-08-10  1:03 ` [RFC v4 16/24] RISC-V: The ABI implementation for the 32-bit Alistair Francis
2019-08-10  1:03 ` [RFC v4 09/24] Documentation for the RISC-V 32-bit port Alistair Francis
2019-08-12 20:02   ` Joseph Myers
2019-08-10  1:04 ` [RFC v4 11/24] RISC-V: define __NR_futex as __NR_futex_time64 for 32-bit Alistair Francis
2019-08-10  1:04 ` [RFC v4 19/24] RISC-V: Build Infastructure for the 32-bit Alistair Francis
2019-08-10  1:04 ` [RFC v4 22/24] RISC-V: Use 64-bit vdso syscalls for RV32 Alistair Francis
2019-08-10  1:04 ` [RFC v4 18/24] RISC-V: Add ABI lists Alistair Francis
2019-08-10  1:04 ` [RFC v4 23/24] WIP: syscall.list: Call 64-bit versions of syscalls Alistair Francis
2019-08-14 18:39   ` Alistair Francis
2019-08-14 18:57     ` Florian Weimer
2019-08-15 21:43       ` Alistair Francis
2019-08-19 11:30         ` Florian Weimer
2019-08-10  1:04 ` [RFC v4 24/24] timerfd_settime: Use 64-bit call if avaliable Alistair Francis
2019-08-10  1:28   ` Alistair Francis
2019-08-20 20:11     ` Maciej W. Rozycki
2019-08-12 20:09   ` Joseph Myers
2019-08-10  1:04 ` [RFC v4 14/24] RISC-V: Support dynamic loader for the 32-bit Alistair Francis
2019-08-10  1:04 ` [RFC v4 20/24] RISC-V: Fix llrint and llround missing exceptions on RV32 Alistair Francis
2019-08-10  1:04 ` [RFC v4 21/24] Add RISC-V 32-bit target to build-many-glibcs.py Alistair Francis

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