mbox series

[v5,00/17] glibc port for 32-bit RISC-V (RV32)

Message ID cover.1597851293.git.alistair.francis@wdc.com
Headers show
Series glibc port for 32-bit RISC-V (RV32) | expand

Message

Alistair Francis Aug. 19, 2020, 3:38 p.m. UTC
This patch set contains the glibc port for 32-bit RISC-V.

This is based on the original work from Zong Li [1] and has been
updated to use a 64-bit time_t.

This requires a 5.4+ kernel and all of the testing has been done using
the 5.4 stable kernel.

Nothing fails when running ./scripts/build-many-glibcs.py (for all
targets) on my x86-64 machine.

This is the current list of tests that fail when running inside QEMU RV32
system emulation on the 5.4 kernel:

FAIL: elf/tst-libc_dlvsym
FAIL: elf/tst-libc_dlvsym-static
FAIL: io/tst-lockf
FAIL: stdlib/tst-strfrom
FAIL: stdlib/tst-strfrom-locale

---Links---
1: https://sourceware.org/ml/libc-alpha/2018-07/msg00892.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.5

---Changelog---
v5:
 - Small fiexes based on v4 comments
v4:
 - Address comments on v3
v3:
 - Re-write the library path detection
 - Drop the ipctypes change
 - Fix comments and code sytle
 - Use __WORDSIZE in replace of __riscv_xlen in places
 - Other changes requested in review
v2:
 - Rebase on master
v1:
 - Update based from feedback on RFCv6
 - Improve test passing
     - There are only 9 tests failing now
 - Rebase on Lukasz's work
 - Send only the RV32 specific patches (other patches are already merged
   or on the list)
RFC v6:
 - Rebase on top of accetpted patches
 - Fix issues so that the tests actually run
RFC v5:
 - Hopefully finally get the correct layout for the *64 syscalls
 - Sort out the Changelog
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 (11):
  RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
  RISC-V: Cleanup some of the sysdep.h code
  RISC-V: Use 64-bit-time syscall numbers with the 32-bit port
  RISC-V: Add support for 32-bit vDSO calls
  RISC-V: Add path of library directories for the 32-bit
  RISC-V: Add arch-syscall.h for RV32
  RISC-V: Support the 32-bit ABI implementation
  RISC-V: Add 32-bit ABI lists
  RISC-V: Add the RV32 libm-test-ulps
  riscv32: Specify the arch_minimum_kernel as 5.4
  Documentation for the RISC-V 32-bit port

Zong Li (6):
  RISC-V: Support dynamic loader for the 32-bit
  RISC-V: Add hard float support for 32-bit CPUs
  RISC-V: Fix llrint and llround missing exceptions on RV32
  RISC-V: Add rv32 path to RTLDLIST in ldd
  RISC-V: Build infastructure for 32-bit port
  Add RISC-V 32-bit target to build-many-glibcs.py

 NEWS                                          |   11 +-
 README                                        |    1 +
 scripts/build-many-glibcs.py                  |   15 +
 sysdeps/riscv/bits/wordsize.h                 |    9 +-
 sysdeps/riscv/nptl/bits/pthreadtypes-arch.h   |   26 +-
 sysdeps/riscv/nptl/bits/struct_rwlock.h       |   27 +-
 sysdeps/riscv/nptl/pthread-offsets.h          |   17 +-
 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/libm-test-ulps         | 1405 ++++++++++++
 sysdeps/riscv/rv32/rvd/libm-test-ulps-name    |    1 +
 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                       |    7 +-
 sysdeps/unix/sysv/linux/riscv/Makefile        |    8 +-
 .../unix/sysv/linux/riscv/bits/environments.h |   81 +
 sysdeps/unix/sysv/linux/riscv/bits/time64.h   |   36 +
 sysdeps/unix/sysv/linux/riscv/bits/timesize.h |   22 +
 sysdeps/unix/sysv/linux/riscv/configure       |   43 +
 sysdeps/unix/sysv/linux/riscv/configure.ac    |   12 +
 sysdeps/unix/sysv/linux/riscv/dl-cache.h      |   54 +-
 .../unix/sysv/linux/riscv/jmp_buf-macros.h    |   55 +
 sysdeps/unix/sysv/linux/riscv/kernel_stat.h   |   23 +
 sysdeps/unix/sysv/linux/riscv/ldconfig.h      |    2 +-
 sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed |    2 +-
 sysdeps/unix/sysv/linux/riscv/rv32/Implies    |    3 +
 .../unix/sysv/linux/riscv/rv32/arch-syscall.h |  284 +++
 .../unix/sysv/linux/riscv/rv32/c++-types.data |   67 +
 sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist |    5 +
 .../linux/riscv/rv32/libBrokenLocale.abilist  |    1 +
 .../unix/sysv/linux/riscv/rv32/libanl.abilist |    4 +
 .../unix/sysv/linux/riscv/rv32/libc.abilist   | 1935 +++++++++++++++++
 .../sysv/linux/riscv/rv32/libcrypt.abilist    |    2 +
 .../unix/sysv/linux/riscv/rv32/libdl.abilist  |    9 +
 .../unix/sysv/linux/riscv/rv32/libm.abilist   |  940 ++++++++
 .../sysv/linux/riscv/rv32/libpthread.abilist  |  213 ++
 .../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        |   59 +-
 48 files changed, 5681 insertions(+), 68 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/libm-test-ulps
 create mode 100644 sysdeps/riscv/rv32/rvd/libm-test-ulps-name
 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/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/kernel_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/Implies
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/c++-types.data
 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

Comments

Maciej W. Rozycki Aug. 20, 2020, 1:11 p.m. UTC | #1
On Wed, 19 Aug 2020, Alistair Francis via Libc-alpha wrote:

> This is the current list of tests that fail when running inside QEMU RV32
> system emulation on the 5.4 kernel:
> 
> FAIL: elf/tst-libc_dlvsym
> FAIL: elf/tst-libc_dlvsym-static
> FAIL: io/tst-lockf
> FAIL: stdlib/tst-strfrom
> FAIL: stdlib/tst-strfrom-locale

 How does it compare to RV64 results in a corresponding environment?

  Maciej
Alistair Francis Aug. 20, 2020, 10:37 p.m. UTC | #2
On Wed, Aug 19, 2020 at 8:48 AM Alistair Francis
<alistair.francis@wdc.com> wrote:
>
> This patch set contains the glibc port for 32-bit RISC-V.
>
> This is based on the original work from Zong Li [1] and has been
> updated to use a 64-bit time_t.
>
> This requires a 5.4+ kernel and all of the testing has been done using
> the 5.4 stable kernel.
>
> Nothing fails when running ./scripts/build-many-glibcs.py (for all
> targets) on my x86-64 machine.
>
> This is the current list of tests that fail when running inside QEMU RV32
> system emulation on the 5.4 kernel:
>
> FAIL: elf/tst-libc_dlvsym
> FAIL: elf/tst-libc_dlvsym-static
> FAIL: io/tst-lockf
> FAIL: stdlib/tst-strfrom
> FAIL: stdlib/tst-strfrom-locale

For anyone interested I'm talking about the 32-bit RISC-V port at
Plumbers next week. Please come along and discuss

https://linuxplumbersconf.org/event/7/contributions/809/

Alistair

>
> ---Links---
> 1: https://sourceware.org/ml/libc-alpha/2018-07/msg00892.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.5
>
> ---Changelog---
> v5:
>  - Small fiexes based on v4 comments
> v4:
>  - Address comments on v3
> v3:
>  - Re-write the library path detection
>  - Drop the ipctypes change
>  - Fix comments and code sytle
>  - Use __WORDSIZE in replace of __riscv_xlen in places
>  - Other changes requested in review
> v2:
>  - Rebase on master
> v1:
>  - Update based from feedback on RFCv6
>  - Improve test passing
>      - There are only 9 tests failing now
>  - Rebase on Lukasz's work
>  - Send only the RV32 specific patches (other patches are already merged
>    or on the list)
> RFC v6:
>  - Rebase on top of accetpted patches
>  - Fix issues so that the tests actually run
> RFC v5:
>  - Hopefully finally get the correct layout for the *64 syscalls
>  - Sort out the Changelog
> 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 (11):
>   RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
>   RISC-V: Cleanup some of the sysdep.h code
>   RISC-V: Use 64-bit-time syscall numbers with the 32-bit port
>   RISC-V: Add support for 32-bit vDSO calls
>   RISC-V: Add path of library directories for the 32-bit
>   RISC-V: Add arch-syscall.h for RV32
>   RISC-V: Support the 32-bit ABI implementation
>   RISC-V: Add 32-bit ABI lists
>   RISC-V: Add the RV32 libm-test-ulps
>   riscv32: Specify the arch_minimum_kernel as 5.4
>   Documentation for the RISC-V 32-bit port
>
> Zong Li (6):
>   RISC-V: Support dynamic loader for the 32-bit
>   RISC-V: Add hard float support for 32-bit CPUs
>   RISC-V: Fix llrint and llround missing exceptions on RV32
>   RISC-V: Add rv32 path to RTLDLIST in ldd
>   RISC-V: Build infastructure for 32-bit port
>   Add RISC-V 32-bit target to build-many-glibcs.py
>
>  NEWS                                          |   11 +-
>  README                                        |    1 +
>  scripts/build-many-glibcs.py                  |   15 +
>  sysdeps/riscv/bits/wordsize.h                 |    9 +-
>  sysdeps/riscv/nptl/bits/pthreadtypes-arch.h   |   26 +-
>  sysdeps/riscv/nptl/bits/struct_rwlock.h       |   27 +-
>  sysdeps/riscv/nptl/pthread-offsets.h          |   17 +-
>  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/libm-test-ulps         | 1405 ++++++++++++
>  sysdeps/riscv/rv32/rvd/libm-test-ulps-name    |    1 +
>  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                       |    7 +-
>  sysdeps/unix/sysv/linux/riscv/Makefile        |    8 +-
>  .../unix/sysv/linux/riscv/bits/environments.h |   81 +
>  sysdeps/unix/sysv/linux/riscv/bits/time64.h   |   36 +
>  sysdeps/unix/sysv/linux/riscv/bits/timesize.h |   22 +
>  sysdeps/unix/sysv/linux/riscv/configure       |   43 +
>  sysdeps/unix/sysv/linux/riscv/configure.ac    |   12 +
>  sysdeps/unix/sysv/linux/riscv/dl-cache.h      |   54 +-
>  .../unix/sysv/linux/riscv/jmp_buf-macros.h    |   55 +
>  sysdeps/unix/sysv/linux/riscv/kernel_stat.h   |   23 +
>  sysdeps/unix/sysv/linux/riscv/ldconfig.h      |    2 +-
>  sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed |    2 +-
>  sysdeps/unix/sysv/linux/riscv/rv32/Implies    |    3 +
>  .../unix/sysv/linux/riscv/rv32/arch-syscall.h |  284 +++
>  .../unix/sysv/linux/riscv/rv32/c++-types.data |   67 +
>  sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist |    5 +
>  .../linux/riscv/rv32/libBrokenLocale.abilist  |    1 +
>  .../unix/sysv/linux/riscv/rv32/libanl.abilist |    4 +
>  .../unix/sysv/linux/riscv/rv32/libc.abilist   | 1935 +++++++++++++++++
>  .../sysv/linux/riscv/rv32/libcrypt.abilist    |    2 +
>  .../unix/sysv/linux/riscv/rv32/libdl.abilist  |    9 +
>  .../unix/sysv/linux/riscv/rv32/libm.abilist   |  940 ++++++++
>  .../sysv/linux/riscv/rv32/libpthread.abilist  |  213 ++
>  .../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        |   59 +-
>  48 files changed, 5681 insertions(+), 68 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/libm-test-ulps
>  create mode 100644 sysdeps/riscv/rv32/rvd/libm-test-ulps-name
>  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/jmp_buf-macros.h
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/kernel_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/Implies
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/c++-types.data
>  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
>
> --
> 2.28.0
>
Alistair Francis Aug. 21, 2020, 3:25 p.m. UTC | #3
On Thu, Aug 20, 2020 at 6:12 AM Maciej W. Rozycki via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On Wed, 19 Aug 2020, Alistair Francis via Libc-alpha wrote:
>
> > This is the current list of tests that fail when running inside QEMU RV32
> > system emulation on the 5.4 kernel:
> >
> > FAIL: elf/tst-libc_dlvsym
> > FAIL: elf/tst-libc_dlvsym-static
> > FAIL: io/tst-lockf
> > FAIL: stdlib/tst-strfrom
> > FAIL: stdlib/tst-strfrom-locale
>
>  How does it compare to RV64 results in a corresponding environment?

I just finished running the tests and the RV64 failing tests look like this:

FAIL: elf/tst-audit2
FAIL: nptl/tst-cancel28
FAIL: stdlib/tst-strfrom
FAIL: stdlib/tst-strfrom-locale

NOTE: This doesn't include the failing maths tests (that is an issue
only when running on QEMU) or the PLT issue for RISC-V 32-bit.

Alistair

>
>   Maciej
Alistair Francis Aug. 21, 2020, 3:43 p.m. UTC | #4
On Wed, Aug 19, 2020 at 8:48 AM Alistair Francis
<alistair.francis@wdc.com> wrote:
>
> This patch set contains the glibc port for 32-bit RISC-V.
>
> This is based on the original work from Zong Li [1] and has been
> updated to use a 64-bit time_t.
>
> This requires a 5.4+ kernel and all of the testing has been done using
> the 5.4 stable kernel.
>
> Nothing fails when running ./scripts/build-many-glibcs.py (for all
> targets) on my x86-64 machine.

This series has now been fully reviewed :)

I am planning on pushing it next week unless anyone has any comments
before then. I'll probably wait until after the discussion at Plumbers
in case anything comes up there that should be changed.

Alistair

>
> This is the current list of tests that fail when running inside QEMU RV32
> system emulation on the 5.4 kernel:
>
> FAIL: elf/tst-libc_dlvsym
> FAIL: elf/tst-libc_dlvsym-static
> FAIL: io/tst-lockf
> FAIL: stdlib/tst-strfrom
> FAIL: stdlib/tst-strfrom-locale
>
> ---Links---
> 1: https://sourceware.org/ml/libc-alpha/2018-07/msg00892.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.5
>
> ---Changelog---
> v5:
>  - Small fiexes based on v4 comments
> v4:
>  - Address comments on v3
> v3:
>  - Re-write the library path detection
>  - Drop the ipctypes change
>  - Fix comments and code sytle
>  - Use __WORDSIZE in replace of __riscv_xlen in places
>  - Other changes requested in review
> v2:
>  - Rebase on master
> v1:
>  - Update based from feedback on RFCv6
>  - Improve test passing
>      - There are only 9 tests failing now
>  - Rebase on Lukasz's work
>  - Send only the RV32 specific patches (other patches are already merged
>    or on the list)
> RFC v6:
>  - Rebase on top of accetpted patches
>  - Fix issues so that the tests actually run
> RFC v5:
>  - Hopefully finally get the correct layout for the *64 syscalls
>  - Sort out the Changelog
> 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 (11):
>   RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
>   RISC-V: Cleanup some of the sysdep.h code
>   RISC-V: Use 64-bit-time syscall numbers with the 32-bit port
>   RISC-V: Add support for 32-bit vDSO calls
>   RISC-V: Add path of library directories for the 32-bit
>   RISC-V: Add arch-syscall.h for RV32
>   RISC-V: Support the 32-bit ABI implementation
>   RISC-V: Add 32-bit ABI lists
>   RISC-V: Add the RV32 libm-test-ulps
>   riscv32: Specify the arch_minimum_kernel as 5.4
>   Documentation for the RISC-V 32-bit port
>
> Zong Li (6):
>   RISC-V: Support dynamic loader for the 32-bit
>   RISC-V: Add hard float support for 32-bit CPUs
>   RISC-V: Fix llrint and llround missing exceptions on RV32
>   RISC-V: Add rv32 path to RTLDLIST in ldd
>   RISC-V: Build infastructure for 32-bit port
>   Add RISC-V 32-bit target to build-many-glibcs.py
>
>  NEWS                                          |   11 +-
>  README                                        |    1 +
>  scripts/build-many-glibcs.py                  |   15 +
>  sysdeps/riscv/bits/wordsize.h                 |    9 +-
>  sysdeps/riscv/nptl/bits/pthreadtypes-arch.h   |   26 +-
>  sysdeps/riscv/nptl/bits/struct_rwlock.h       |   27 +-
>  sysdeps/riscv/nptl/pthread-offsets.h          |   17 +-
>  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/libm-test-ulps         | 1405 ++++++++++++
>  sysdeps/riscv/rv32/rvd/libm-test-ulps-name    |    1 +
>  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                       |    7 +-
>  sysdeps/unix/sysv/linux/riscv/Makefile        |    8 +-
>  .../unix/sysv/linux/riscv/bits/environments.h |   81 +
>  sysdeps/unix/sysv/linux/riscv/bits/time64.h   |   36 +
>  sysdeps/unix/sysv/linux/riscv/bits/timesize.h |   22 +
>  sysdeps/unix/sysv/linux/riscv/configure       |   43 +
>  sysdeps/unix/sysv/linux/riscv/configure.ac    |   12 +
>  sysdeps/unix/sysv/linux/riscv/dl-cache.h      |   54 +-
>  .../unix/sysv/linux/riscv/jmp_buf-macros.h    |   55 +
>  sysdeps/unix/sysv/linux/riscv/kernel_stat.h   |   23 +
>  sysdeps/unix/sysv/linux/riscv/ldconfig.h      |    2 +-
>  sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed |    2 +-
>  sysdeps/unix/sysv/linux/riscv/rv32/Implies    |    3 +
>  .../unix/sysv/linux/riscv/rv32/arch-syscall.h |  284 +++
>  .../unix/sysv/linux/riscv/rv32/c++-types.data |   67 +
>  sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist |    5 +
>  .../linux/riscv/rv32/libBrokenLocale.abilist  |    1 +
>  .../unix/sysv/linux/riscv/rv32/libanl.abilist |    4 +
>  .../unix/sysv/linux/riscv/rv32/libc.abilist   | 1935 +++++++++++++++++
>  .../sysv/linux/riscv/rv32/libcrypt.abilist    |    2 +
>  .../unix/sysv/linux/riscv/rv32/libdl.abilist  |    9 +
>  .../unix/sysv/linux/riscv/rv32/libm.abilist   |  940 ++++++++
>  .../sysv/linux/riscv/rv32/libpthread.abilist  |  213 ++
>  .../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        |   59 +-
>  48 files changed, 5681 insertions(+), 68 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/libm-test-ulps
>  create mode 100644 sysdeps/riscv/rv32/rvd/libm-test-ulps-name
>  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/jmp_buf-macros.h
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/kernel_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/Implies
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
>  create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/c++-types.data
>  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
>
> --
> 2.28.0
>
Maciej W. Rozycki Aug. 22, 2020, 1:04 p.m. UTC | #5
On Fri, 21 Aug 2020, Alistair Francis wrote:

> > > This is the current list of tests that fail when running inside QEMU RV32
> > > system emulation on the 5.4 kernel:
> > >
> > > FAIL: elf/tst-libc_dlvsym
> > > FAIL: elf/tst-libc_dlvsym-static
> > > FAIL: io/tst-lockf
> > > FAIL: stdlib/tst-strfrom
> > > FAIL: stdlib/tst-strfrom-locale
> >
> >  How does it compare to RV64 results in a corresponding environment?
> 
> I just finished running the tests and the RV64 failing tests look like this:
> 
> FAIL: elf/tst-audit2
> FAIL: nptl/tst-cancel28
> FAIL: stdlib/tst-strfrom
> FAIL: stdlib/tst-strfrom-locale

 Sigh, I hoped the results would be the same, which we could then blame on 
some common issues across RISC-V ports.  I can imagine `tst-lockf' being 
caused by some Linux kernel issue, however `dlvsym' issues likely come 
from our dynamic loader or maybe the static linker.

 Would you be able to see if there is any interesting information in the 
respective .out files and/or the overall test log?

 NB to save some processing time and have results available sooner you can 
rerun coarse subsets of the test suite if you need to, by removing the 
relevant (or all) .out files from any previous testing and then running:

$ make <args> subdirs="<foo> <bar> ..." check

to limit testing to the subdirectories named, e.g.:

$ make <args> subdirs="elf io" check

(substitute <args> with any other arguments you usually use with testing 
glibc).

> NOTE: This doesn't include the failing maths tests (that is an issue
> only when running on QEMU) or the PLT issue for RISC-V 32-bit.

 Ack.  Can you check if the PLT issue has been fixed with 
<https://sourceware.org/pipermail/binutils/2020-August/112750.html>?

  Maciej
Andreas Schwab Aug. 22, 2020, 1:44 p.m. UTC | #6
On Aug 22 2020, Maciej W. Rozycki via Libc-alpha wrote:

>  NB to save some processing time and have results available sooner you can 
> rerun coarse subsets of the test suite if you need to, by removing the 
> relevant (or all) .out files from any previous testing and then running:
>
> $ make <args> subdirs="<foo> <bar> ..." check
>
> to limit testing to the subdirectories named, e.g.:
>
> $ make <args> subdirs="elf io" check
>
> (substitute <args> with any other arguments you usually use with testing 
> glibc).

You can also make $subdir/tests to run tests in a single subdir.

Andreas.
Alistair Francis Aug. 24, 2020, 5:18 p.m. UTC | #7
On Sat, Aug 22, 2020 at 6:04 AM Maciej W. Rozycki <macro@wdc.com> wrote:
>
> On Fri, 21 Aug 2020, Alistair Francis wrote:
>
> > > > This is the current list of tests that fail when running inside QEMU RV32
> > > > system emulation on the 5.4 kernel:
> > > >
> > > > FAIL: elf/tst-libc_dlvsym
> > > > FAIL: elf/tst-libc_dlvsym-static
> > > > FAIL: io/tst-lockf
> > > > FAIL: stdlib/tst-strfrom
> > > > FAIL: stdlib/tst-strfrom-locale
> > >
> > >  How does it compare to RV64 results in a corresponding environment?
> >
> > I just finished running the tests and the RV64 failing tests look like this:
> >
> > FAIL: elf/tst-audit2
> > FAIL: nptl/tst-cancel28
> > FAIL: stdlib/tst-strfrom
> > FAIL: stdlib/tst-strfrom-locale
>
>  Sigh, I hoped the results would be the same, which we could then blame on
> some common issues across RISC-V ports.  I can imagine `tst-lockf' being
> caused by some Linux kernel issue, however `dlvsym' issues likely come
> from our dynamic loader or maybe the static linker.
>
>  Would you be able to see if there is any interesting information in the
> respective .out files and/or the overall test log?

Yep, see below for the RV32 failure logs:

elf/tst-libc_dlvsym.out
error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version
error: 1 test failures

elf/tst-libc_dlvsym-static.out
error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version

io/tst-lockf.out
error: subprocess failed: lockf
error:   unexpected output from subprocess
tst-lockf.c:49: numeric comparison failure
   left: 0 (0x0); from: lockf (temp_fd, F_TEST, 1024)
  right: -1 (0xffffffff); from: -1
error: 2 test failures

stdlib/tst-strfrom.out
Testing in locale: C
strfromf: got NAN (3), expected -NAN (4)
strfromf32: got NAN (3), expected -NAN (4)
Testing in locale: en_US.ISO-8859-1
strfromf: got NAN (3), expected -NAN (4)
strfromf32: got NAN (3), expected -NAN (4)
Testing in locale: en_US.UTF-8
strfromf: got NAN (3), expected -NAN (4)
strfromf32: got NAN (3), expected -NAN (4)

stdlib/tst-strfrom-locale.out
Testing in locale: de_DE.UTF-8
strfromf: got NAN (3), expected -NAN (4)
strfromf32: got NAN (3), expected -NAN (4)
Testing in locale: tr_TR.ISO-8859-9
strfromf: got NAN (3), expected -NAN (4)
strfromf32: got NAN (3), expected -NAN (4)
Testing in locale: tr_TR.UTF-8
strfromf: got NAN (3), expected -NAN (4)
strfromf32: got NAN (3), expected -NAN (4)

I'm assuming that stdlib/tst-strfrom and stdlib/tst-strfrom-locale are
just related to QEMU FP bugs, as they fail for both RV32 and RV64.

I'll look into the missing _sys_errlist symbol

>
>  NB to save some processing time and have results available sooner you can
> rerun coarse subsets of the test suite if you need to, by removing the
> relevant (or all) .out files from any previous testing and then running:
>
> $ make <args> subdirs="<foo> <bar> ..." check
>
> to limit testing to the subdirectories named, e.g.:
>
> $ make <args> subdirs="elf io" check
>
> (substitute <args> with any other arguments you usually use with testing
> glibc).

Thanks.

>
> > NOTE: This doesn't include the failing maths tests (that is an issue
> > only when running on QEMU) or the PLT issue for RISC-V 32-bit.
>
>  Ack.  Can you check if the PLT issue has been fixed with
> <https://sourceware.org/pipermail/binutils/2020-August/112750.html>?

Yes, using the latest binutils with those patches applied seems to fix
the PLT failures.

Alistair

>
>   Maciej
Maciej W. Rozycki Aug. 24, 2020, 6:17 p.m. UTC | #8
On Mon, 24 Aug 2020, Alistair Francis wrote:

> >  Would you be able to see if there is any interesting information in the
> > respective .out files and/or the overall test log?
> 
> Yep, see below for the RV32 failure logs:
> 
> elf/tst-libc_dlvsym.out
> error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version
> error: 1 test failures
> 
> elf/tst-libc_dlvsym-static.out
> error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version

 Well, we have this in NEWS:

* The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr
  are no longer available to newly linked binaries, and their declarations
  have been removed from from <stdio.h>.  They are exported solely as
  compatibility symbols to support old binaries.  All programs should use
  strerror or strerror_r instead.

so it looks like a test case bug to me; the symbol is expected not to be 
there given that we have no compatibility with previous library versions 
to take care of.  Not a showstopper for RV32 inclusion IMO.

> io/tst-lockf.out
> error: subprocess failed: lockf
> error:   unexpected output from subprocess
> tst-lockf.c:49: numeric comparison failure
>    left: 0 (0x0); from: lockf (temp_fd, F_TEST, 1024)
>   right: -1 (0xffffffff); from: -1
> error: 2 test failures

 This might be more interesting to look into further; as `len' is of the 
`off_t' type it would be good to double-check it is correctly handled.

> stdlib/tst-strfrom.out
> Testing in locale: C
> strfromf: got NAN (3), expected -NAN (4)
> strfromf32: got NAN (3), expected -NAN (4)
> Testing in locale: en_US.ISO-8859-1
> strfromf: got NAN (3), expected -NAN (4)
> strfromf32: got NAN (3), expected -NAN (4)
> Testing in locale: en_US.UTF-8
> strfromf: got NAN (3), expected -NAN (4)
> strfromf32: got NAN (3), expected -NAN (4)
> 
> stdlib/tst-strfrom-locale.out
> Testing in locale: de_DE.UTF-8
> strfromf: got NAN (3), expected -NAN (4)
> strfromf32: got NAN (3), expected -NAN (4)
> Testing in locale: tr_TR.ISO-8859-9
> strfromf: got NAN (3), expected -NAN (4)
> strfromf32: got NAN (3), expected -NAN (4)
> Testing in locale: tr_TR.UTF-8
> strfromf: got NAN (3), expected -NAN (4)
> strfromf32: got NAN (3), expected -NAN (4)
> 
> I'm assuming that stdlib/tst-strfrom and stdlib/tst-strfrom-locale are
> just related to QEMU FP bugs, as they fail for both RV32 and RV64.

 Agreed, and in any case RV32 does not perform any worse than RV64.  Of 
course it would be good to look into it anyway, but it shouldn't be a 
showstopper for RV32 inclusion IMO.

> > > NOTE: This doesn't include the failing maths tests (that is an issue
> > > only when running on QEMU) or the PLT issue for RISC-V 32-bit.
> >
> >  Ack.  Can you check if the PLT issue has been fixed with
> > <https://sourceware.org/pipermail/binutils/2020-August/112750.html>?
> 
> Yes, using the latest binutils with those patches applied seems to fix
> the PLT failures.

 Good to know, thanks for confirming.  So I guess we can ignore the PLT 
check failure and expect anyone caring about clean results to use most up 
to date binutils once the fix has been included (and until then use the 
patch applied locally).

 I've cc-ed Nelson to give him some incentive to upstream his fix quickly.

  Maciej
Joseph Myers Aug. 24, 2020, 10:41 p.m. UTC | #9
On Mon, 24 Aug 2020, Alistair Francis via Libc-alpha wrote:

> elf/tst-libc_dlvsym.out
> error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version
> error: 1 test failures
> 
> elf/tst-libc_dlvsym-static.out
> error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version

The tests of _sys_errlist and _sys_siglist in elf/tst-libc_dlvsym.h need 
TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_32) conditionals added, to disable 
them for configurations lacking those symbols.

> I'm assuming that stdlib/tst-strfrom and stdlib/tst-strfrom-locale are
> just related to QEMU FP bugs, as they fail for both RV32 and RV64.

I think my previous comments still apply on how you might need a hook in 
these functions to handle the RISC-V rules about NaN results for 
floating-point operations.

https://sourceware.org/legacy-ml/libc-alpha/2018-01/msg01062.html
Alistair Francis Aug. 25, 2020, 6:15 p.m. UTC | #10
On Mon, Aug 24, 2020 at 11:17 AM Maciej W. Rozycki <macro@wdc.com> wrote:
>
> On Mon, 24 Aug 2020, Alistair Francis wrote:
>
> > >  Would you be able to see if there is any interesting information in the
> > > respective .out files and/or the overall test log?
> >
> > Yep, see below for the RV32 failure logs:
> >
> > elf/tst-libc_dlvsym.out
> > error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version
> > error: 1 test failures
> >
> > elf/tst-libc_dlvsym-static.out
> > error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version
>
>  Well, we have this in NEWS:
>
> * The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr
>   are no longer available to newly linked binaries, and their declarations
>   have been removed from from <stdio.h>.  They are exported solely as
>   compatibility symbols to support old binaries.  All programs should use
>   strerror or strerror_r instead.
>
> so it looks like a test case bug to me; the symbol is expected not to be
> there given that we have no compatibility with previous library versions
> to take care of.  Not a showstopper for RV32 inclusion IMO.

Yep, it looks like this is a test failure. I'll send a patch out now with a fix.

>
> > io/tst-lockf.out
> > error: subprocess failed: lockf
> > error:   unexpected output from subprocess
> > tst-lockf.c:49: numeric comparison failure
> >    left: 0 (0x0); from: lockf (temp_fd, F_TEST, 1024)
> >   right: -1 (0xffffffff); from: -1
> > error: 2 test failures
>
>  This might be more interesting to look into further; as `len' is of the
> `off_t' type it would be good to double-check it is correctly handled.

I have fixed this as well, the test is incorrectly calling the lockf()
function (not 64-bit version). I'll send a patch.

With these three fixed we now have the same two failures as RV64 :)

Alistair

>
> > stdlib/tst-strfrom.out
> > Testing in locale: C
> > strfromf: got NAN (3), expected -NAN (4)
> > strfromf32: got NAN (3), expected -NAN (4)
> > Testing in locale: en_US.ISO-8859-1
> > strfromf: got NAN (3), expected -NAN (4)
> > strfromf32: got NAN (3), expected -NAN (4)
> > Testing in locale: en_US.UTF-8
> > strfromf: got NAN (3), expected -NAN (4)
> > strfromf32: got NAN (3), expected -NAN (4)
> >
> > stdlib/tst-strfrom-locale.out
> > Testing in locale: de_DE.UTF-8
> > strfromf: got NAN (3), expected -NAN (4)
> > strfromf32: got NAN (3), expected -NAN (4)
> > Testing in locale: tr_TR.ISO-8859-9
> > strfromf: got NAN (3), expected -NAN (4)
> > strfromf32: got NAN (3), expected -NAN (4)
> > Testing in locale: tr_TR.UTF-8
> > strfromf: got NAN (3), expected -NAN (4)
> > strfromf32: got NAN (3), expected -NAN (4)
> >
> > I'm assuming that stdlib/tst-strfrom and stdlib/tst-strfrom-locale are
> > just related to QEMU FP bugs, as they fail for both RV32 and RV64.
>
>  Agreed, and in any case RV32 does not perform any worse than RV64.  Of
> course it would be good to look into it anyway, but it shouldn't be a
> showstopper for RV32 inclusion IMO.
>
> > > > NOTE: This doesn't include the failing maths tests (that is an issue
> > > > only when running on QEMU) or the PLT issue for RISC-V 32-bit.
> > >
> > >  Ack.  Can you check if the PLT issue has been fixed with
> > > <https://sourceware.org/pipermail/binutils/2020-August/112750.html>?
> >
> > Yes, using the latest binutils with those patches applied seems to fix
> > the PLT failures.
>
>  Good to know, thanks for confirming.  So I guess we can ignore the PLT
> check failure and expect anyone caring about clean results to use most up
> to date binutils once the fix has been included (and until then use the
> patch applied locally).
>
>  I've cc-ed Nelson to give him some incentive to upstream his fix quickly.

Thanks.

Alistair

>
>   Maciej
Alistair Francis Aug. 25, 2020, 6:20 p.m. UTC | #11
On Mon, Aug 24, 2020 at 3:41 PM Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Mon, 24 Aug 2020, Alistair Francis via Libc-alpha wrote:
>
> > elf/tst-libc_dlvsym.out
> > error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version
> > error: 1 test failures
> >
> > elf/tst-libc_dlvsym-static.out
> > error: tst-libc_dlvsym.h:103: symbol _sys_errlist not found at any version
>
> The tests of _sys_errlist and _sys_siglist in elf/tst-libc_dlvsym.h need
> TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_32) conditionals added, to disable
> them for configurations lacking those symbols.

Thanks! This fixes the test failure. I'm just running some tests then
I'll send a patch.

>
> > I'm assuming that stdlib/tst-strfrom and stdlib/tst-strfrom-locale are
> > just related to QEMU FP bugs, as they fail for both RV32 and RV64.
>
> I think my previous comments still apply on how you might need a hook in
> these functions to handle the RISC-V rules about NaN results for
> floating-point operations.
>
> https://sourceware.org/legacy-ml/libc-alpha/2018-01/msg01062.html

Thanks for pointing this out, I'll have to investigate.

Alistair

>
> --
> Joseph S. Myers
> joseph@codesourcery.com
Nelson Chu Aug. 26, 2020, 1:15 a.m. UTC | #12
On Tue, Aug 25, 2020 at 2:17 AM Maciej W. Rozycki <macro@wdc.com> wrote:
> > > > NOTE: This doesn't include the failing maths tests (that is an issue
> > > > only when running on QEMU) or the PLT issue for RISC-V 32-bit.
> > >
> > >  Ack.  Can you check if the PLT issue has been fixed with
> > > <https://sourceware.org/pipermail/binutils/2020-August/112750.html>?
> >
> > Yes, using the latest binutils with those patches applied seems to fix
> > the PLT failures.
>
>  Good to know, thanks for confirming.  So I guess we can ignore the PLT
> check failure and expect anyone caring about clean results to use most up
> to date binutils once the fix has been included (and until then use the
> patch applied locally).
>
>  I've cc-ed Nelson to give him some incentive to upstream his fix quickly.

Good to know that the patch could help.  Thanks for the information,
Maciej and Alistair.  I will resend at least the PLT improvement patch
(Regard the R_RISCV_CALL and R_RISCV_CALL_PLT as the same one) ASAP.

Thanks
Nelson
Alistair Francis Aug. 26, 2020, 3:43 p.m. UTC | #13
On Tue, Aug 25, 2020 at 6:15 PM Nelson Chu <nelson.chu@sifive.com> wrote:
>
> On Tue, Aug 25, 2020 at 2:17 AM Maciej W. Rozycki <macro@wdc.com> wrote:
> > > > > NOTE: This doesn't include the failing maths tests (that is an issue
> > > > > only when running on QEMU) or the PLT issue for RISC-V 32-bit.
> > > >
> > > >  Ack.  Can you check if the PLT issue has been fixed with
> > > > <https://sourceware.org/pipermail/binutils/2020-August/112750.html>?
> > >
> > > Yes, using the latest binutils with those patches applied seems to fix
> > > the PLT failures.
> >
> >  Good to know, thanks for confirming.  So I guess we can ignore the PLT
> > check failure and expect anyone caring about clean results to use most up
> > to date binutils once the fix has been included (and until then use the
> > patch applied locally).
> >
> >  I've cc-ed Nelson to give him some incentive to upstream his fix quickly.
>
> Good to know that the patch could help.  Thanks for the information,
> Maciej and Alistair.  I will resend at least the PLT improvement patch
> (Regard the R_RISCV_CALL and R_RISCV_CALL_PLT as the same one) ASAP.

Thanks for that.

Just an update on test cases.

With the binutils patch applied I see no failures when running
./scripts/build-many-glibcs.py on my x86 machine (without the binutils
patch I see PLT failures).

With the binutils patch applied and the two patches I just sent to the
list I see these failures on RV32 in QEMU:

FAIL: nptl/tst-cancelx16
FAIL: stdlib/tst-strfrom
FAIL: stdlib/tst-strfrom-locale

nptl/tst-cancelx16.out fails with:
cleanup handler not called

I think the other two failures are related to:
https://sourceware.org/legacy-ml/libc-alpha/2018-01/msg01062.html

I'm planning on pushing this series tomorrow.

Alistair

>
> Thanks
> Nelson
Maciej W. Rozycki Aug. 26, 2020, 4:06 p.m. UTC | #14
On Tue, 25 Aug 2020, Alistair Francis wrote:

> > > io/tst-lockf.out
> > > error: subprocess failed: lockf
> > > error:   unexpected output from subprocess
> > > tst-lockf.c:49: numeric comparison failure
> > >    left: 0 (0x0); from: lockf (temp_fd, F_TEST, 1024)
> > >   right: -1 (0xffffffff); from: -1
> > > error: 2 test failures
> >
> >  This might be more interesting to look into further; as `len' is of the
> > `off_t' type it would be good to double-check it is correctly handled.
> 
> I have fixed this as well, the test is incorrectly calling the lockf()
> function (not 64-bit version). I'll send a patch.

 Shouldn't `lockf' and `lockf64' be aliases to each other on RV32?  IOW do 
we support a non-LFS environment at all?

 (Of course the test case may still require an adjustment as it seems to 
imply non-LFS support to be present, i.e.:

  /* Check if non-LFS interface cap access to 32-bif off_t.  */
  TEST_COMPARE (lseek64 (temp_fd, (off64_t)INT32_MAX, SEEK_SET),
		(off64_t)INT32_MAX);

though I find it odd as 64-bit targets starting from DEC Alpha have never 
had it.)

  Maciej
Joseph Myers Aug. 28, 2020, 6:19 p.m. UTC | #15
On Mon, 24 Aug 2020, Maciej W. Rozycki via Libc-alpha wrote:

> > > > NOTE: This doesn't include the failing maths tests (that is an issue
> > > > only when running on QEMU) or the PLT issue for RISC-V 32-bit.
> > >
> > >  Ack.  Can you check if the PLT issue has been fixed with
> > > <https://sourceware.org/pipermail/binutils/2020-August/112750.html>?
> > 
> > Yes, using the latest binutils with those patches applied seems to fix
> > the PLT failures.
> 
>  Good to know, thanks for confirming.  So I guess we can ignore the PLT 
> check failure and expect anyone caring about clean results to use most up 
> to date binutils once the fix has been included (and until then use the 
> patch applied locally).
> 
>  I've cc-ed Nelson to give him some incentive to upstream his fix quickly.

Will this be backported to binutils 2.35 branch (which is what 
build-many-glibcs.py uses by default - thus, showing test failures 
https://sourceware.org/pipermail/libc-testresults/2020q3/006687.html on 
the bot with GCC 10)?
Maciej W. Rozycki Aug. 29, 2020, 9:41 p.m. UTC | #16
On Wed, 26 Aug 2020, Alistair Francis wrote:

> I'm planning on pushing this series tomorrow.

 Umm, in the future please run `git rebase --ignore-date origin/master' 
before pushing changes upstream to a GNU toolchain repository so that 
change dates remain chronological in the branch.

  Maciej