mbox series

[v4,00/11] nds32 glibc port, v4

Message ID 1559735815-20093-1-git-send-email-vincentc@andestech.com
Headers show
Series nds32 glibc port, v4 | expand

Message

Vincent Chen June 5, 2019, 11:56 a.m. UTC
This is the fourth version of the nds32 port. I am sorry that one year has
passed since the previous submission. The most obvious modification in this
version patchset is that FPU extension is supported now.In addition,
the mainline of gcc and binutils has contained the nds32 ports.Hence, the
nds32 toolchain without FPU extension support can be derived through
build-many-glibcs.py. The toolchain with FPU extension needs an extra kernel
patchset to successfully compile. This patchset has been pulled and may be
released in 5.2 rc-4. The implementations for nds32 FPU extension are like
other architecture except for the following two parts.

Part 1. The calling convention for variable argument function.
          The ABI of nds32 FPU is different to the original ABI, especially
        in the transmission of variable arguments.In nds32 original ABI, if
        the summation of the number of variable arguments and the constant
        arguments are lesser than 6, the caller function still uses general
        purpose register to pass the variable argument.However, in nds32 FPU
        extension ABI, the caller function directly places the variable
        arguments to stack no matter what the number of argument. This causes
        these functions with variable arguments cannot use internal_syscallX
        macro to issue syscall. Hence the generic builds from syscalls.list
        cannot be used for nds32 FPU extension ABI.
Part 2. Overcome the limitation of nds32 FPU on denormalize output.
          For most floating point instructions, the denormalized output is
        treated as an underflow case.Hence, if the underflow trap is not
        enabled, the output is rounded to a normalized number according to
        the rounding mode. The accuracy loss from the approximation is
        possibly not acceptable for some applications. Hence we added an nds32
        specific feature that the kernel can intervene in this kind of
        floating point operation and recalculate it by kernel's soft-fp
        module.In order for the kernel to capture each denormalized output,
        the underflow and inexact bit in $fpcsr, floating pointer control
        status register, should be set when this feature is enabled in the
        kernel. In addition, a new kernel parameter, UDF_IEX_trap, replaces
        $fpcsr to control the state of the user's inexact and underflow trap.
        Hence each operation as regard the floating point environment needs to
        issue a syscall with the number NR_fp_udfiex_crtl to access the
        parameter UDF_IEX_trap to get the state of inexact and underflow trap.
        In this mechanism, kernel uses the initial value of $fpcsr to notify
        glibc whether this feature is enable or not. To avoid overriding the
        initial value of $fpcsr, nds32 specific function __setfpucw is defined.

  From the recent discussions in mailing list, I know that the functions such as
clock_settime for Y2038-proof syscall are under development, and I guess that
these functions may not ready before glibc-2.30 code freeze. If nds32 port is
approved by maintainers to the upstream in glibc-2.30 release, does it mean
nds32 ports need to support Y2038-incompatiable functions ? Please correct me
if I have wrong understanding.


The patchest has been cross-tested on the FPGA board based on Linux 5.2 rc-2
and glibc commit 004e52f ebf30012ab (May 21).

The detail result
https://github.com/andestech/glibc/blob/nds32-glibc-2.29-v4/nds32_v3_glibc_test_result.tar.gz
https://github.com/andestech/glibc/blob/nds32-glibc-2.29-v4/nds32_v3f_glibc_test_result.tar.gz

A. Summarize for test results

   A1. nds32 port with FP extension toolchain
     53 FAIL (15 XFAIL cases are not included)
     4983 PASS
     34 UNSUPPORTED
   A2. nds32 port
     32 FAIL (15 XFAIL cases are not included)
     5003 PASS
     34 UNSUPPORTED

   The FAIL cases of nds32 FP extension toolchain are same to the nds32
   toolchain except for 20 FAIL cases in math and stdlib/tst-tininess.
   nds32 toolchain pass these 21 testcases.

B. The analysis of FAIL cases: 
   1. The following 20 cases have same error behevior, namespace violation:
      "SIOCGSTAMP_OLD", "SIOCGSTAMPNSD", "fds_bits" and "val". The cause of 
      the first two cases, "SIOCGSTAMP_OLD" and "SIOCGSTAMPNSD", is the same
      that Linux kernel recently added the definition of these two macros in
      asm-generic/sockios.h. For the last two cases, kernel header
      uapi/asm-generic/socket.h includes linux/posix_types.h instead of
      asm/bitsperlong.h. This change introduces the two variables "fds_bits"
      and "val" declared in the linux/posix_types.h and
      asm-generic/posix_types.h.
      conform/XOPEN2K/netinet/in.h/conform
      conform/XOPEN2K/sys/socket.h/conform
      conform/XOPEN2K/netdb.h/conform
      conform/XOPEN2K/arpa/inet.h/conform
      conform/XPG42/netinet/in.h/conform
      conform/XPG42/sys/socket.h/conform
      conform/XPG42/netdb.h/conform
      conform/XPG42/arpa/inet.h/conform
      conform/POSIX2008/netinet/in.h/conform
      conform/POSIX2008/sys/socket.h/conform
      conform/POSIX2008/netdb.h/conform
      conform/POSIX2008/arpa/inet.h/conform
      conform/UNIX98/netinet/in.h/conform
      conform/UNIX98/sys/socket.h/conform
      conform/UNIX98/netdb.h/conform
      conform/UNIX98/arpa/inet.h/conform
      conform/XOPEN2K8/netinet/in.h/conform
      conform/XOPEN2K8/sys/socket.h/conform
      conform/XOPEN2K8/netdb.h/conform
      conform/XOPEN2K8/arpa/inet.h/conform

   2. locale/tst-locale-locpath
        I found that the failure is caused by missing the environment parameter
      when this testcase is executed on FPGA through cross-test-ssh.sh. I try
      to modify the Makefile rule of tst-locale-locpath.out to "$(SHELL) $<
      '$(common-objpfx)' '$(test-wrapper-env)' '$(run_program_env)' > $ @;"
      .However, the content of $ (run_program_env) is empty so that the
      environment parameter is still empty.
        The testcase passed if I set the environment parameters by manually.

   3. libio/tst-wfile-sync.test-result
        The testcases will try to operate the standard input file by lseek
      function. However, the standard input is pipe instead of file if this
      testcase run on FPGA through cross-test-ssh.sh. This causes testcase gets
      an unexpected error ESPIPE from the return of the lseek function.
        The testcase passed if it was directly executed on FPGA board.

   4. sysvipc/test-sysvsem.test-result
	This testcase fails due to unexpected error number, EINVAL, from
      function semtimedop. The bug is due to wrong syscall handler of
      NR_semtimedop for native 32bit architecture. In Linux 5.2 rc2, the syscall
      handler selection of NR_semtimedop is through 
      __SC_COMP(__NR_semtimedop, sys_semtimedop, sys_semtimedop_time32). It
      makes the native 32-bit architecture always select the function
      sys_semtimedop as the syscall handler, which uses a 64-bit timespec to
      parse the input parameter timeout. I had sent a mail to check the
      correctness of above deductions with Arnd Bergmann before submitting this
      patchset.

   6. The soft-fp module in Linux kernel is too old to the following 21 cases
      cannot pass.
      FAIL: math/test-double-finite-lround
      FAIL: math/test-double-lround
      FAIL: math/test-float-double-add
      FAIL: math/test-float-double-sub
      FAIL: math/test-float-ldouble-add
      FAIL: math/test-float-ldouble-sub
      FAIL: math/test-float32-float32x-add
      FAIL: math/test-float32-float32x-sub
      FAIL: math/test-float32-float64-add
      FAIL: math/test-float32-float64-sub
      FAIL: math/test-float32x-finite-lround
      FAIL: math/test-float32x-lround
      FAIL: math/test-float64-finite-lround
      FAIL: math/test-float64-lround
      FAIL: math/test-ldouble-finite-lround
      FAIL: math/test-ldouble-lround
      FAIL: math/test-float32-fma
      FAIL: math/test-float-fma
      FAIL: math/test-float32-finite-fma
      FAIL: math/test-float-finite-fma
      FAIL: stdlib/tst-tininess

        The cause of failure can be divided to two parts.
      Part 1. If the value can be rounded to most negative integer, the result
              of FP_TO_INT_D or FP_TO_INT_ROUND_D is incorrect. The example
              case is lround (-0x80000000.4p0). In this case, FP_TO_INT_D
              returns most negative integer 0x80000000 and raises the Invalid
              exception flag.
      Part 2. To Overcome the limitation of nds32 FPU on denormalize output,
              any underflow and inexact case will issue a FPU trap that
              notifies the kernel to recalculate the floating point operation
              through kernel's soft-fp module. However, the soft-fp module in
              Linux kernel does not support TININESS_AFTER_ROUNDING but nds32
              FPU is TININESS_AFTER_ROUNDING. This mismatch causes some
              testcases to fail because the underflow exception flag is raised,
              such as  stdlib/tst-tininess, add_double (-0x4p-1024, 0x4p-128)
              and fma (-0x7.ffffep-128, 0x8.00001p-4, -0x8p-152).
        I tried to port the latest soft-fp module from glibc to kernel, and the
      above 21 failed testcases turned into PASS based on the latest soft-fp
      module. By the way, I found that Joseph tried to update the soft-fp
      module in Linux kernel in 2015, but the last status of the patchset seems
      to remain pending due to the lack of ACK from sparc maintainer. Does
      Joseph have any plans to resend the patchset?

   7. misc/tst-syscall-list
        This case turns to PASS if I add NR_fp_udfiex_crtl to 
      linux/syscall-names.list  

   The remaining FAIL cases are same with v3 patchest

   8.  The following 6 testcase fail because the testing environment lacks
       native python: 
      ./nptl/test-condattr-printers
      ./nptl/test-cond-printers
      ./nptl/test-mutexattr-printers
      ./nptl/test-mutex-printers
      ./nptl/test-rwlockattr-printers
      ./nptl/test-rwlock-printers

   9.  stdio-common/bug22 
         The required memory size for this testcase is more than 2 GB but
       the DRAM size on our FPGA is just 2GB. Therefore, the errno is set as
       ENOMEM instead of EOVERFLOW.

  10.  bug20790.test-result
         It fails because the testing environment lacks native cpp

The short log of the changes since our v3 includes:
* Add FP extension support
* Use init_array to call PREINIT_FUNCTION
* Modify ports to meet current program flow. 
* Update Copyright


[v3] The highlight of the changes since our v2 includes:
* Add MAP_FIXED_NOREPLACE definition to mman.h
* Mark _init and _fini as hidden in nds32 crti.S
* Replace u_long with unsigned long int
* Add a space between __attribute__ and '((' in sysdeps/nds32/bits/setjmp.h.
* Remove fno-isolate-erroneous-paths-dereference option from nds32 Makefile
  after adding __builtin_trap support to gcc
* Set arch_minimum_kernel as 4.17.0
* Replace 'long' and 'unsigned long' with 'long int' and 'unsigned long int'
* Remove the comma which is after the last element of an enum in
  sysdeps/nds32/bits/fenv.h
* Correct copyright
* Remove empty ABI test baselines
* Code cleanup for syscall.c
* Code cleanup for sysdeps/nds32/tls-macros.h

[v2] The highlight of the changes since our v1 includes:
* Update ABI list.
* Upadate libm-test-ulps file.
* Add fno-isolate-erroneous-paths-dereference compile option to
  CFLAGS-divrem.c to avoid compiler calling abort() function for
  divde-by-zero case.
* Update the list of register preservation and move the list from
  sysdeps/nds32/__longjmp.S to sysdeps/nds32/setjmp.h.
* Remove sysdeps/nds32/backtrace.c.
* Remove big endian support.
* Add description for compile option -minline-asm-r15 to configure file.
* Refine sysdeps/nds32/dl-machine.h.
* Remove sysdeps/nds32/math_private.h
* Refine memcpy and memset function of nds32 version
* Define THREAD_GSCOPE_IN_TCB in sysdeps/nds32/nptl/tls.h to fix compiler
  error
* Rename dynamic linker based on supported ABI.
* Remove big endian support
* To use generic fork function, define __ASSUME_CLONE_BACKWARDS and remove
  nds32 arch-fork.h
* Remove nds32 kernel_sigaction.h
* Remove nds32 readahead.c
* Remove unused macro from sigcontextinfo.h
* Refine nds32 syscall.c
* Add MAP_SYNC from Linux 4.15
* Add change log to the end of each commit.




CheWei Chunang (1):
  Add nds32 port to build-many-glibcs.py

Vincent Chen (10):
  nds32: Build Infastructure
  nds32: ABI Implementation
  nds32: Thread-Local Storage Support
  nds32: Startup and Dynamic Loader
  nds32: Generic <math.h>, soft-fp and hard-fp Routines
  nds32: Atomic and Locking Routines
  nds32: Linux Syscall Interface
  nds32: Linux ABI
  nds32: Add ABI list
  Add nds32 entries to config.h.in

 config.h.in                                        |    3 +
 locale/Makefile                                    |    2 +-
 scripts/build-many-glibcs.py                       |   13 +
 sysdeps/nds32/Implies                              |    4 +
 sysdeps/nds32/Makefile                             |   12 +
 sysdeps/nds32/__longjmp.S                          |   67 +
 sysdeps/nds32/atomic-machine.h                     |  162 ++
 sysdeps/nds32/bits/endian.h                        |   29 +
 sysdeps/nds32/bits/fenv.h                          |   96 +
 sysdeps/nds32/bits/link.h                          |   54 +
 sysdeps/nds32/bits/setjmp.h                        |   60 +
 sysdeps/nds32/bsd-_setjmp.S                        |    1 +
 sysdeps/nds32/bsd-setjmp.S                         |    1 +
 sysdeps/nds32/configure                            |   10 +
 sysdeps/nds32/configure.ac                         |   10 +
 sysdeps/nds32/dl-machine.h                         |  405 ++++
 sysdeps/nds32/dl-sysdep.h                          |   22 +
 sysdeps/nds32/dl-tls.h                             |   28 +
 sysdeps/nds32/dl-tlsdesc.S                         |  104 +
 sysdeps/nds32/dl-tlsdesc.h                         |   62 +
 sysdeps/nds32/dl-trampoline.S                      |  164 ++
 sysdeps/nds32/fpu/e_sqrt.c                         |   27 +
 sysdeps/nds32/fpu/e_sqrtf.c                        |   26 +
 sysdeps/nds32/fpu/fclrexcpt.c                      |   42 +
 sysdeps/nds32/fpu/fedisblxcpt.c                    |   58 +
 sysdeps/nds32/fpu/feenablxcpt.c                    |   57 +
 sysdeps/nds32/fpu/fegetenv.c                       |   44 +
 sysdeps/nds32/fpu/fegetexcept.c                    |   41 +
 sysdeps/nds32/fpu/fegetmode.c                      |   39 +
 sysdeps/nds32/fpu/fegetround.c                     |   29 +
 sysdeps/nds32/fpu/feholdexcpt.c                    |   29 +
 sysdeps/nds32/fpu/fenv_private.h                   |  229 +++
 sysdeps/nds32/fpu/fesetenv.c                       |   30 +
 sysdeps/nds32/fpu/fesetexcept.c                    |   34 +
 sysdeps/nds32/fpu/fesetmode.c                      |   53 +
 sysdeps/nds32/fpu/fesetround.c                     |   35 +
 sysdeps/nds32/fpu/feupdateenv.c                    |   31 +
 sysdeps/nds32/fpu/fgetexcptflg.c                   |   27 +
 sysdeps/nds32/fpu/fix-fp-int-compare-invalid.h     |   25 +
 sysdeps/nds32/fpu/fix-fp-int-convert-overflow.h    |   34 +
 sysdeps/nds32/fpu/fpu_control.h                    |  104 +
 sysdeps/nds32/fpu/fraiseexcpt.c                    |  100 +
 sysdeps/nds32/fpu/fsetexcptflg.c                   |   39 +
 sysdeps/nds32/fpu/ftestexcept.c                    |   27 +
 sysdeps/nds32/fpu/get-rounding-mode.h              |   39 +
 sysdeps/nds32/fpu/libm-test-ulps                   | 1643 ++++++++++++++++
 sysdeps/nds32/fpu/libm-test-ulps-name              |    1 +
 sysdeps/nds32/fpu/math-barriers.h                  |   27 +
 sysdeps/nds32/gccframe.h                           |   21 +
 sysdeps/nds32/jmpbuf-offsets.h                     |   34 +
 sysdeps/nds32/jmpbuf-unwind.h                      |   47 +
 sysdeps/nds32/ldsodefs.h                           |   44 +
 sysdeps/nds32/linkmap.h                            |   25 +
 sysdeps/nds32/machine-gmon.h                       |   34 +
 sysdeps/nds32/memcpy.S                             |  101 +
 sysdeps/nds32/memset.S                             |  120 ++
 sysdeps/nds32/memusage.h                           |   21 +
 sysdeps/nds32/nofpu/Implies                        |    1 +
 sysdeps/nds32/nofpu/libm-test-ulps                 |  390 ++++
 sysdeps/nds32/nofpu/libm-test-ulps-name            |    1 +
 sysdeps/nds32/nptl/Makefile                        |    4 +
 sysdeps/nds32/nptl/bits/pthreadtypes-arch.h        |   71 +
 sysdeps/nds32/nptl/bits/semaphore.h                |   32 +
 sysdeps/nds32/nptl/pthread-offsets.h               |   23 +
 sysdeps/nds32/nptl/pthreaddef.h                    |   33 +
 sysdeps/nds32/nptl/tcb-offsets.sym                 |    7 +
 sysdeps/nds32/nptl/tls.h                           |  155 ++
 sysdeps/nds32/preconfigure                         |   37 +
 sysdeps/nds32/setjmp.S                             |  103 +
 sysdeps/nds32/sfp-machine.h                        |   68 +
 sysdeps/nds32/sotruss-lib.c                        |   50 +
 sysdeps/nds32/stackinfo.h                          |   32 +
 sysdeps/nds32/start.S                              |  124 ++
 sysdeps/nds32/strcmp.S                             |  105 +
 sysdeps/nds32/strcpy.S                             |   75 +
 sysdeps/nds32/sysdep.h                             |   70 +
 sysdeps/nds32/tininess.h                           |    1 +
 sysdeps/nds32/tls-macros.h                         |   75 +
 sysdeps/nds32/tlsdesc.c                            |   38 +
 sysdeps/nds32/tlsdesc.sym                          |   16 +
 sysdeps/nds32/tst-audit.h                          |   23 +
 sysdeps/unix/sysv/linux/nds32/Implies              |    3 +
 sysdeps/unix/sysv/linux/nds32/Makefile             |   16 +
 sysdeps/unix/sysv/linux/nds32/Versions             |   11 +
 sysdeps/unix/sysv/linux/nds32/bits/fcntl.h         |   53 +
 sysdeps/unix/sysv/linux/nds32/bits/procfs.h        |   40 +
 sysdeps/unix/sysv/linux/nds32/bits/shmlba.h        |   24 +
 sysdeps/unix/sysv/linux/nds32/c++-types.data       |   67 +
 sysdeps/unix/sysv/linux/nds32/clone.S              |   70 +
 sysdeps/unix/sysv/linux/nds32/configure            |    4 +
 sysdeps/unix/sysv/linux/nds32/configure.ac         |    4 +
 sysdeps/unix/sysv/linux/nds32/dl-static.c          |   84 +
 sysdeps/unix/sysv/linux/nds32/fpu/Makefile         |    3 +
 sysdeps/unix/sysv/linux/nds32/fpu/ioctl.c          |   37 +
 sysdeps/unix/sysv/linux/nds32/fpu/mremap.c         |   37 +
 sysdeps/unix/sysv/linux/nds32/fpu/prctl.c          |   40 +
 sysdeps/unix/sysv/linux/nds32/fpu/setfpucw.c       |   50 +
 sysdeps/unix/sysv/linux/nds32/getcontext.S         |  102 +
 sysdeps/unix/sysv/linux/nds32/init-first.c         |   48 +
 sysdeps/unix/sysv/linux/nds32/ipc_priv.h           |   22 +
 sysdeps/unix/sysv/linux/nds32/jmp_buf-macros.h     |   33 +
 sysdeps/unix/sysv/linux/nds32/kernel-features.h    |   31 +
 sysdeps/unix/sysv/linux/nds32/ld.abilist           |    9 +
 sysdeps/unix/sysv/linux/nds32/ldconfig.h           |   27 +
 sysdeps/unix/sysv/linux/nds32/ldsodefs.h           |   32 +
 .../unix/sysv/linux/nds32/libBrokenLocale.abilist  |    1 +
 sysdeps/unix/sysv/linux/nds32/libanl.abilist       |    4 +
 sysdeps/unix/sysv/linux/nds32/libc-vdso.h          |   32 +
 sysdeps/unix/sysv/linux/nds32/libc.abilist         | 2080 ++++++++++++++++++++
 sysdeps/unix/sysv/linux/nds32/libcrypt.abilist     |    2 +
 sysdeps/unix/sysv/linux/nds32/libdl.abilist        |    9 +
 sysdeps/unix/sysv/linux/nds32/libm.abilist         |  753 +++++++
 sysdeps/unix/sysv/linux/nds32/libpthread.abilist   |  235 +++
 sysdeps/unix/sysv/linux/nds32/libresolv.abilist    |   79 +
 sysdeps/unix/sysv/linux/nds32/librt.abilist        |   35 +
 sysdeps/unix/sysv/linux/nds32/libthread_db.abilist |   40 +
 sysdeps/unix/sysv/linux/nds32/libutil.abilist      |    6 +
 sysdeps/unix/sysv/linux/nds32/localplt.data        |   19 +
 sysdeps/unix/sysv/linux/nds32/makecontext.c        |   57 +
 sysdeps/unix/sysv/linux/nds32/profil-counter.h     |   31 +
 sysdeps/unix/sysv/linux/nds32/pt-vfork.S           |    1 +
 sysdeps/unix/sysv/linux/nds32/setcontext.S         |  111 ++
 sysdeps/unix/sysv/linux/nds32/shlib-versions       |    9 +
 sysdeps/unix/sysv/linux/nds32/sigcontextinfo.h     |   35 +
 sysdeps/unix/sysv/linux/nds32/swapcontext.S        |  154 ++
 sysdeps/unix/sysv/linux/nds32/sys/cachectl.h       |   33 +
 sysdeps/unix/sysv/linux/nds32/sys/ucontext.h       |   88 +
 sysdeps/unix/sysv/linux/nds32/sys/user.h           |   22 +
 sysdeps/unix/sysv/linux/nds32/syscall.c            |   39 +
 sysdeps/unix/sysv/linux/nds32/syscalls.list        |    3 +
 sysdeps/unix/sysv/linux/nds32/sysctl.mk            |    1 +
 sysdeps/unix/sysv/linux/nds32/sysdep.c             |   29 +
 sysdeps/unix/sysv/linux/nds32/sysdep.h             |  340 ++++
 sysdeps/unix/sysv/linux/nds32/ucontext_i.sym       |   28 +
 sysdeps/unix/sysv/linux/nds32/vfork.S              |   46 +
 135 files changed, 11328 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/nds32/Implies
 create mode 100644 sysdeps/nds32/Makefile
 create mode 100644 sysdeps/nds32/__longjmp.S
 create mode 100644 sysdeps/nds32/atomic-machine.h
 create mode 100644 sysdeps/nds32/bits/endian.h
 create mode 100644 sysdeps/nds32/bits/fenv.h
 create mode 100644 sysdeps/nds32/bits/link.h
 create mode 100644 sysdeps/nds32/bits/setjmp.h
 create mode 100644 sysdeps/nds32/bsd-_setjmp.S
 create mode 100644 sysdeps/nds32/bsd-setjmp.S
 create mode 100755 sysdeps/nds32/configure
 create mode 100644 sysdeps/nds32/configure.ac
 create mode 100644 sysdeps/nds32/dl-machine.h
 create mode 100644 sysdeps/nds32/dl-sysdep.h
 create mode 100644 sysdeps/nds32/dl-tls.h
 create mode 100644 sysdeps/nds32/dl-tlsdesc.S
 create mode 100644 sysdeps/nds32/dl-tlsdesc.h
 create mode 100644 sysdeps/nds32/dl-trampoline.S
 create mode 100644 sysdeps/nds32/fpu/e_sqrt.c
 create mode 100644 sysdeps/nds32/fpu/e_sqrtf.c
 create mode 100644 sysdeps/nds32/fpu/fclrexcpt.c
 create mode 100644 sysdeps/nds32/fpu/fedisblxcpt.c
 create mode 100644 sysdeps/nds32/fpu/feenablxcpt.c
 create mode 100644 sysdeps/nds32/fpu/fegetenv.c
 create mode 100644 sysdeps/nds32/fpu/fegetexcept.c
 create mode 100644 sysdeps/nds32/fpu/fegetmode.c
 create mode 100644 sysdeps/nds32/fpu/fegetround.c
 create mode 100644 sysdeps/nds32/fpu/feholdexcpt.c
 create mode 100644 sysdeps/nds32/fpu/fenv_private.h
 create mode 100644 sysdeps/nds32/fpu/fesetenv.c
 create mode 100644 sysdeps/nds32/fpu/fesetexcept.c
 create mode 100644 sysdeps/nds32/fpu/fesetmode.c
 create mode 100644 sysdeps/nds32/fpu/fesetround.c
 create mode 100644 sysdeps/nds32/fpu/feupdateenv.c
 create mode 100644 sysdeps/nds32/fpu/fgetexcptflg.c
 create mode 100644 sysdeps/nds32/fpu/fix-fp-int-compare-invalid.h
 create mode 100644 sysdeps/nds32/fpu/fix-fp-int-convert-overflow.h
 create mode 100644 sysdeps/nds32/fpu/fpu_control.h
 create mode 100644 sysdeps/nds32/fpu/fraiseexcpt.c
 create mode 100644 sysdeps/nds32/fpu/fsetexcptflg.c
 create mode 100644 sysdeps/nds32/fpu/ftestexcept.c
 create mode 100644 sysdeps/nds32/fpu/get-rounding-mode.h
 create mode 100644 sysdeps/nds32/fpu/libm-test-ulps
 create mode 100644 sysdeps/nds32/fpu/libm-test-ulps-name
 create mode 100644 sysdeps/nds32/fpu/math-barriers.h
 create mode 100644 sysdeps/nds32/gccframe.h
 create mode 100644 sysdeps/nds32/jmpbuf-offsets.h
 create mode 100644 sysdeps/nds32/jmpbuf-unwind.h
 create mode 100644 sysdeps/nds32/ldsodefs.h
 create mode 100644 sysdeps/nds32/linkmap.h
 create mode 100644 sysdeps/nds32/machine-gmon.h
 create mode 100644 sysdeps/nds32/memcpy.S
 create mode 100644 sysdeps/nds32/memset.S
 create mode 100644 sysdeps/nds32/memusage.h
 create mode 100644 sysdeps/nds32/nofpu/Implies
 create mode 100644 sysdeps/nds32/nofpu/libm-test-ulps
 create mode 100644 sysdeps/nds32/nofpu/libm-test-ulps-name
 create mode 100644 sysdeps/nds32/nptl/Makefile
 create mode 100644 sysdeps/nds32/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/nds32/nptl/bits/semaphore.h
 create mode 100644 sysdeps/nds32/nptl/pthread-offsets.h
 create mode 100644 sysdeps/nds32/nptl/pthreaddef.h
 create mode 100644 sysdeps/nds32/nptl/tcb-offsets.sym
 create mode 100644 sysdeps/nds32/nptl/tls.h
 create mode 100644 sysdeps/nds32/preconfigure
 create mode 100644 sysdeps/nds32/setjmp.S
 create mode 100644 sysdeps/nds32/sfp-machine.h
 create mode 100644 sysdeps/nds32/sotruss-lib.c
 create mode 100644 sysdeps/nds32/stackinfo.h
 create mode 100644 sysdeps/nds32/start.S
 create mode 100644 sysdeps/nds32/strcmp.S
 create mode 100644 sysdeps/nds32/strcpy.S
 create mode 100644 sysdeps/nds32/sysdep.h
 create mode 100644 sysdeps/nds32/tininess.h
 create mode 100644 sysdeps/nds32/tls-macros.h
 create mode 100644 sysdeps/nds32/tlsdesc.c
 create mode 100644 sysdeps/nds32/tlsdesc.sym
 create mode 100644 sysdeps/nds32/tst-audit.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/Implies
 create mode 100644 sysdeps/unix/sysv/linux/nds32/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/nds32/Versions
 create mode 100644 sysdeps/unix/sysv/linux/nds32/bits/fcntl.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/bits/procfs.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/bits/shmlba.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/nds32/clone.S
 create mode 100755 sysdeps/unix/sysv/linux/nds32/configure
 create mode 100644 sysdeps/unix/sysv/linux/nds32/configure.ac
 create mode 100644 sysdeps/unix/sysv/linux/nds32/dl-static.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/fpu/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/nds32/fpu/ioctl.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/fpu/mremap.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/fpu/prctl.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/fpu/setfpucw.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/nds32/init-first.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/ipc_priv.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/kernel-features.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/ldconfig.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/ldsodefs.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libBrokenLocale.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libanl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libc-vdso.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libc.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libcrypt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libdl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libm.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libpthread.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libresolv.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/librt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libthread_db.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/libutil.abilist
 create mode 100644 sysdeps/unix/sysv/linux/nds32/localplt.data
 create mode 100644 sysdeps/unix/sysv/linux/nds32/makecontext.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/profil-counter.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/pt-vfork.S
 create mode 100644 sysdeps/unix/sysv/linux/nds32/setcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/nds32/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/nds32/sigcontextinfo.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/swapcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/nds32/sys/cachectl.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/sys/ucontext.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/sys/user.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/syscall.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/nds32/sysctl.mk
 create mode 100644 sysdeps/unix/sysv/linux/nds32/sysdep.c
 create mode 100644 sysdeps/unix/sysv/linux/nds32/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/nds32/ucontext_i.sym
 create mode 100644 sysdeps/unix/sysv/linux/nds32/vfork.S

Comments

Florian Weimer June 5, 2019, 12:28 p.m. UTC | #1
* Vincent Chen:

>    7. misc/tst-syscall-list
>         This case turns to PASS if I add NR_fp_udfiex_crtl to 
>       linux/syscall-names.list

I think the actual system call name is fp_udfiex_crtl, and this can go
in immediately as a separate patch (it's not necessary to wait for the
upstream kernel release).

Thanks,
Florian
Vincent Chen June 6, 2019, 2:59 a.m. UTC | #2
On Wed, Jun 05, 2019 at 08:28:15PM +0800, Florian Weimer wrote:
> * Vincent Chen:
> 
> >    7. misc/tst-syscall-list
> >         This case turns to PASS if I add NR_fp_udfiex_crtl to 
> >       linux/syscall-names.list
> 
> I think the actual system call name is fp_udfiex_crtl, and this can go
> in immediately as a separate patch (it's not necessary to wait for the
> upstream kernel release).
>
Yes, the actual system call name is fp_udfiex_crtl. I will use a
separate patch to complete it in the next version patchset.

Thanks,
Vincent
Joseph Myers June 6, 2019, 10:34 p.m. UTC | #3
On Wed, 5 Jun 2019, Vincent Chen wrote:

>   This is the fourth version of the nds32 port. I am sorry that one year has
> passed since the previous submission. The most obvious modification in this
> version patchset is that FPU extension is supported now.In addition,
> the mainline of gcc and binutils has contained the nds32 ports.Hence, the
> nds32 toolchain without FPU extension support can be derived through
> build-many-glibcs.py. The toolchain with FPU extension needs an extra kernel
> patchset to successfully compile. This patchset has been pulled and may be
> released in 5.2 rc-4. The implementations for nds32 FPU extension are like
> other architecture except for the following two parts.

Please see <https://sourceware.org/glibc/wiki/NewPorts> and make sure the 
port submission follows what is described there.  In particular: (a) give 
pointers to the relevant instruction set and ABI manuals 
(<https://gcc.gnu.org/readings.html> points to a page with a great many 
manuals, pointers directly to exactly the ones that are relevant would be 
helpful); (b) fix coding style issues, such as brace positioning, 
indentation and missing spaces before '('.

> B. The analysis of FAIL cases: 
>    1. The following 20 cases have same error behevior, namespace violation:
>       "SIOCGSTAMP_OLD", "SIOCGSTAMPNSD", "fds_bits" and "val". The cause of 
>       the first two cases, "SIOCGSTAMP_OLD" and "SIOCGSTAMPNSD", is the same
>       that Linux kernel recently added the definition of these two macros in
>       asm-generic/sockios.h. For the last two cases, kernel header
>       uapi/asm-generic/socket.h includes linux/posix_types.h instead of
>       asm/bitsperlong.h. This change introduces the two variables "fds_bits"
>       and "val" declared in the linux/posix_types.h and
>       asm-generic/posix_types.h.

fds_bits and val are a generic Linux kernel issue - a patch was sent to 
linux-api in March and acked by David Miller but still didn't get into the 
Linux kernel in 5.1 (and, indeed, still hasn't got into the kernel).  I'm 
not sure what the holdup is there, but for now we should assume that Linux 
kernel header versions later than 5.0 are not suitable for use in glibc 
(and so probably avoid adding any new ports depending on newer kernel 
header versions, because of the possibility of being unable to test them 
effectively for an indefinite period while build-many-glibcs.py is stuck 
on 5.0).

The others also sound like a generic issue.  Please *start a separate 
thread on them, not part of the port submission*.  Is this like the case 
where sysdeps/unix/sysv/linux/bits/socket.h has

/* Ugly workaround for unclean kernel headers.  */

for some existing macros?  If so, you should send a patch for that, 
extending the workaround to the new macros (again, not part of the port 
submission, not marked as part of the port submission, because it's an 
independent issue).

>    2. locale/tst-locale-locpath
>         I found that the failure is caused by missing the environment parameter
>       when this testcase is executed on FPGA through cross-test-ssh.sh. I try
>       to modify the Makefile rule of tst-locale-locpath.out to "$(SHELL) $<
>       '$(common-objpfx)' '$(test-wrapper-env)' '$(run_program_env)' > $ @;"
>       .However, the content of $ (run_program_env) is empty so that the
>       environment parameter is still empty.
>         The testcase passed if I set the environment parameters by manually.

Again, start an independent thread on this issue.  I'm not sure if 
$(run_program_env) should be passed at all (given how this test is 
deliberately overriding the default environment), but in any case, the 
call in the Makefile should be consistent with the test script - and this 
needs to be discussed outside the context of a port submission.

>    3. libio/tst-wfile-sync.test-result
>         The testcases will try to operate the standard input file by lseek
>       function. However, the standard input is pipe instead of file if this
>       testcase run on FPGA through cross-test-ssh.sh. This causes testcase gets
>       an unexpected error ESPIPE from the return of the lseek function.
>         The testcase passed if it was directly executed on FPGA board.

Likewise, start a separate thread, not marked as part of a port 
submission, for any such architecture-independent issue; resolve such 
issues first and ensure the port submission only needs to include 
genuinely architecture-specific patches.

>         I tried to port the latest soft-fp module from glibc to kernel, and the
>       above 21 failed testcases turned into PASS based on the latest soft-fp
>       module. By the way, I found that Joseph tried to update the soft-fp
>       module in Linux kernel in 2015, but the last status of the patchset seems
>       to remain pending due to the lack of ACK from sparc maintainer. Does
>       Joseph have any plans to resend the patchset?

No.  It was accepted by the powerpc maintainers into a branch with a 
statement "I'll ask Stephen to put it in linux-next once 4.3-rc1 is out, 
and I'll ask Linus to pull it for 4.4".  I don't know what the holdup is 
that stopped it going further.  There was an issue with sparc compilers 
that didn't default to -mlong-double-128, but a patch for that was added 
in Nov 2015.  There was a build robot reporting new warnings on sh but I 
didn't think they indicated any actual problems that were new with the 
patch (which was acked for sh).

Since that patch series deals with the hard part of an update (i.e. 
updating the kernel code across several architectures for extensive API 
changes in glibc soft-fp made as part of the optimization project 
described in the GCC Summit 2006 proceedings, and subsequently), I think 
it makes sense to integrate that patch series more or less as I posted it 
(plus, I suppose, a corresponding nds32 patch), and then possibly follow 
up with another update of the code to the latest glibc version (much 
easier because of the lack of API changes needing all-architectures 
fixes).

Note: I have a long list of issues with the powerpc math emulation in the 
Linux kernel (i.e., the architecture-specific code) that could reasonably 
be fixed after that series is in, and shorter lists for alpha and sh (all 
of those are lists as of 2015, I don't know if some of the issues might 
have been fixed in the kernel since then).

>    7. misc/tst-syscall-list
>         This case turns to PASS if I add NR_fp_udfiex_crtl to 
>       linux/syscall-names.list  

Again, send a separate patch outside of this series.

>    8.  The following 6 testcase fail because the testing environment lacks
>        native python: 
>       ./nptl/test-condattr-printers
>       ./nptl/test-cond-printers
>       ./nptl/test-mutexattr-printers
>       ./nptl/test-mutex-printers
>       ./nptl/test-rwlockattr-printers
>       ./nptl/test-rwlock-printers
> 
>    9.  stdio-common/bug22 
>          The required memory size for this testcase is more than 2 GB but
>        the DRAM size on our FPGA is just 2GB. Therefore, the errno is set as
>        ENOMEM instead of EOVERFLOW.
> 
>   10.  bug20790.test-result
>          It fails because the testing environment lacks native cpp

These are on the list of known architecture-independent issues on the 
per-release wiki pages, thus can be ignored for the purposes of the 
expectation of no more than 20 architecture-specific test failures.
Florian Weimer June 7, 2019, 7:17 a.m. UTC | #4
* Vincent Chen:

> On Wed, Jun 05, 2019 at 08:28:15PM +0800, Florian Weimer wrote:
>> * Vincent Chen:
>> 
>> >    7. misc/tst-syscall-list
>> >         This case turns to PASS if I add NR_fp_udfiex_crtl to 
>> >       linux/syscall-names.list
>> 
>> I think the actual system call name is fp_udfiex_crtl, and this can go
>> in immediately as a separate patch (it's not necessary to wait for the
>> upstream kernel release).

> Yes, the actual system call name is fp_udfiex_crtl. I will use a
> separate patch to complete it in the next version patchset.

You can submit this change separately any time, it is not tied to the
port.

Thanks,
Florian
Vincent Chen June 10, 2019, 3:27 a.m. UTC | #5
On Fri, Jun 07, 2019 at 03:17:58PM +0800, Florian Weimer wrote:
> * Vincent Chen:
> 
> > On Wed, Jun 05, 2019 at 08:28:15PM +0800, Florian Weimer wrote:
> >> * Vincent Chen:
> >> 
> >> >    7. misc/tst-syscall-list
> >> >         This case turns to PASS if I add NR_fp_udfiex_crtl to 
> >> >       linux/syscall-names.list
> >> 
> >> I think the actual system call name is fp_udfiex_crtl, and this can go
> >> in immediately as a separate patch (it's not necessary to wait for the
> >> upstream kernel release).
> 
> > Yes, the actual system call name is fp_udfiex_crtl. I will use a
> > separate patch to complete it in the next version patchset.
> 
> You can submit this change separately any time, it is not tied to the
> port.
>
Ok, I got it. Thank you.

Regards,
vincent
Vincent Chen June 10, 2019, 7:15 a.m. UTC | #6
On Fri, Jun 07, 2019 at 06:34:47AM +0800, Joseph Myers wrote:
> On Wed, 5 Jun 2019, Vincent Chen wrote:
> 
> 
> Please see <https://sourceware.org/glibc/wiki/NewPorts> and make sure the 
> port submission follows what is described there.  In particular: (a) give 
> pointers to the relevant instruction set and ABI manuals 
> (<https://gcc.gnu.org/readings.html> points to a page with a great many 
> manuals, pointers directly to exactly the ones that are relevant would be 
> helpful); (b) fix coding style issues, such as brace positioning, 
> indentation and missing spaces before '('.
> 

Ok

> 
> fds_bits and val are a generic Linux kernel issue - a patch was sent to 
> linux-api in March and acked by David Miller but still didn't get into the 
> Linux kernel in 5.1 (and, indeed, still hasn't got into the kernel).  I'm 
> not sure what the holdup is there, but for now we should assume that Linux 
> kernel header versions later than 5.0 are not suitable for use in glibc 
> (and so probably avoid adding any new ports depending on newer kernel 
> header versions, because of the possibility of being unable to test them 
> effectively for an indefinite period while build-many-glibcs.py is stuck 
> on 5.0).
>

Ok, I will develop nds32 ports based on kernel 5.0 before relevant issues
are fixed in kernel.
 
> The others also sound like a generic issue.  Please *start a separate 
> thread on them, not part of the port submission*.  Is this like the case 
> where sysdeps/unix/sysv/linux/bits/socket.h has
> 
> /* Ugly workaround for unclean kernel headers.  */
> 
> for some existing macros?  If so, you should send a patch for that, 
> extending the workaround to the new macros (again, not part of the port 
> submission, not marked as part of the port submission, because it's an 
> independent issue).
> 

Yes, the issue of the macros "SIOCGSTAMPNS_OLD" and "SIOCGSTAMP_OLD" is similar
to the case in sysdeps/unix/sysv/linux/bits/socket.h. I will send a separate
patch to add these two macros to the workaround list.


> >    2. locale/tst-locale-locpath
> 
> Again, start an independent thread on this issue.  I'm not sure if 
> $(run_program_env) should be passed at all (given how this test is 
> deliberately overriding the default environment), but in any case, the 
> call in the Makefile should be consistent with the test script - and this 
> needs to be discussed outside the context of a port submission.
> 

Ok

> >    3. libio/tst-wfile-sync.test-result
> 
> Likewise, start a separate thread, not marked as part of a port 
> submission, for any such architecture-independent issue; resolve such 
> issues first and ensure the port submission only needs to include 
> genuinely architecture-specific patches.
> 

Ok
> >       to remain pending due to the lack of ACK from sparc maintainer. Does
> >       Joseph have any plans to resend the patchset?
> 
> No.  It was accepted by the powerpc maintainers into a branch with a 
> statement "I'll ask Stephen to put it in linux-next once 4.3-rc1 is out, 
> and I'll ask Linus to pull it for 4.4".  I don't know what the holdup is 
> that stopped it going further.  There was an issue with sparc compilers 
> that didn't default to -mlong-double-128, but a patch for that was added 
> in Nov 2015.  There was a build robot reporting new warnings on sh but I 
> didn't think they indicated any actual problems that were new with the 
> patch (which was acked for sh).
> 
> Since that patch series deals with the hard part of an update (i.e. 
> updating the kernel code across several architectures for extensive API 
> changes in glibc soft-fp made as part of the optimization project 
> described in the GCC Summit 2006 proceedings, and subsequently), I think 
> it makes sense to integrate that patch series more or less as I posted it 
> (plus, I suppose, a corresponding nds32 patch), and then possibly follow 
> up with another update of the code to the latest glibc version (much 
> easier because of the lack of API changes needing all-architectures 
> fixes).
> 
> Note: I have a long list of issues with the powerpc math emulation in the 
> Linux kernel (i.e., the architecture-specific code) that could reasonably 
> be fixed after that series is in, and shorter lists for alpha and sh (all 
> of those are lists as of 2015, I don't know if some of the issues might 
> have been fixed in the kernel since then).
> 

I got it. Thank you very much for the detailed descriptions.

> >    7. misc/tst-syscall-list
> >         This case turns to PASS if I add NR_fp_udfiex_crtl to 
> >       linux/syscall-names.list  
> 
> Again, send a separate patch outside of this series.
>

Ok 


Regards,
Vincent