mbox series

[RFC,V2,00/10] port C-SKY to glibc

Message ID cover.1523169833.git.han_mao@c-sky.com
Headers show
Series port C-SKY to glibc | expand

Message

=?UTF-8?B?5q+b5pmX?= April 8, 2018, 7:02 a.m. UTC
It is a patchset port C-SKY to glibc. More information about us is on
http://en.c-sky.com/.
 
This patchset adds architecture support to Glibc for CK610, CK807, CK810
processor cores. It base on the release version of 2.27.
 
CK610 is the second-generation CPU of CSKY, fullycompatible with M*Core.
CK807/CK810 bases on C-SKY V2 instruction set architecture and 16/32-bit
variable length instruction. Including basic core(CK807/CK810),
floating-point enhancement(CK807F/CK810F), multimedia enhancement (CK810D)
and multiple-processing extension (CK807MP/CK810MP).
 
The porting of C-SKY Glibc is tested in our CI enviroment. Toolchain, kernel,
test packages are built form source code via builtroot. LTP, Lmbench, dhrystone
etc are tested in the enviroment.
Here is our CI envoirnment:
https://gitlab.com/c-sky/buildroot/pipelines
 
Our sources are available on github.com/c-sky. Including gcc, glibc, uclibc-ng
Linux kernel e.g.

Changes since v1:
  - update the changelog format
  - clean up unnecessary legacy code and odd comments
  - add rel description and fix EM_CSKY check
  - remove some arch-specific implementation
  - remove DEPRECATED linux syscall support
  - support pointer mangling

Mao Han (10):
  C-SKY: ABI related code
  C-SKY: TLS support
  C-SKY: Generic math Routines
  C-SKY: Hard Float Support
  C-SKY: Atomic and Locking Routines
  C-SKY: Linux Syscall Interface
  C-SKY: ABI Lists
  C-SKY: Build Infastructure
  C-SKY: Linux Startup and Dynamic Loading Code
  C-SKY: Linux ABI

 elf/elf.h                                          |   67 +-
 scripts/config.sub                                 |    4 +-
 sysdeps/csky/Implies                               |    4 +
 sysdeps/csky/Makefile                              |   13 +
 sysdeps/csky/__longjmp.S                           |   74 +
 sysdeps/csky/abort-instr.h                         |    2 +
 sysdeps/csky/atomic-machine.h                      |  114 ++
 sysdeps/csky/backtrace.c                           |  128 ++
 sysdeps/csky/bits/endian.h                         |   10 +
 sysdeps/csky/bits/fenv.h                           |   97 +
 sysdeps/csky/bits/link.h                           |   54 +
 sysdeps/csky/bits/setjmp.h                         |   34 +
 sysdeps/csky/bsd-_setjmp.S                         |    1 +
 sysdeps/csky/bsd-setjmp.S                          |    1 +
 sysdeps/csky/configure                             |    4 +
 sysdeps/csky/configure.ac                          |    4 +
 sysdeps/csky/crti.S                                |   96 +
 sysdeps/csky/crtn.S                                |   50 +
 sysdeps/csky/csky-mcount.S                         |   87 +
 sysdeps/csky/dl-machine.h                          |  472 +++++
 sysdeps/csky/dl-procinfo.c                         |   62 +
 sysdeps/csky/dl-procinfo.h                         |   59 +
 sysdeps/csky/dl-sysdep.h                           |   23 +
 sysdeps/csky/dl-tls.h                              |   26 +
 sysdeps/csky/dl-tlsdesc.h                          |   61 +
 sysdeps/csky/dl-trampoline.S                       |   88 +
 sysdeps/csky/fenv_private.h                        |  288 +++
 sysdeps/csky/fpu/fclrexcpt.c                       |   47 +
 sysdeps/csky/fpu/fedisblxcpt.c                     |   46 +
 sysdeps/csky/fpu/feenablxcpt.c                     |   45 +
 sysdeps/csky/fpu/fegetenv.c                        |   42 +
 sysdeps/csky/fpu/fegetexcept.c                     |   37 +
 sysdeps/csky/fpu/fegetmode.c                       |   29 +
 sysdeps/csky/fpu/fegetround.c                      |   39 +
 sysdeps/csky/fpu/feholdexcpt.c                     |   39 +
 sysdeps/csky/fpu/fenv_libc.h                       |   29 +
 sysdeps/csky/fpu/fesetenv.c                        |   64 +
 sysdeps/csky/fpu/fesetexcept.c                     |   37 +
 sysdeps/csky/fpu/fesetmode.c                       |   37 +
 sysdeps/csky/fpu/fesetround.c                      |   41 +
 sysdeps/csky/fpu/feupdateenv.c                     |   51 +
 sysdeps/csky/fpu/fgetexcptflg.c                    |   37 +
 sysdeps/csky/fpu/fraiseexcpt.c                     |  131 ++
 sysdeps/csky/fpu/fsetexcptflg.c                    |   48 +
 sysdeps/csky/fpu/ftestexcept.c                     |   35 +
 sysdeps/csky/fpu_control.h                         |  150 ++
 sysdeps/csky/gccframe.h                            |   21 +
 sysdeps/csky/jmpbuf-unwind.h                       |   47 +
 sysdeps/csky/ldsodefs.h                            |   42 +
 sysdeps/csky/libc-tls.c                            |   32 +
 sysdeps/csky/libm-test-ulps                        | 1682 ++++++++++++++++
 sysdeps/csky/libm-test-ulps-name                   |    1 +
 sysdeps/csky/linkmap.h                             |    5 +
 sysdeps/csky/machine-gmon.h                        |   32 +
 sysdeps/csky/macro.S                               |   30 +
 sysdeps/csky/math-tests.h                          |   35 +
 sysdeps/csky/math_private.h                        |    7 +
 sysdeps/csky/memcpy.S                              |  400 ++++
 sysdeps/csky/memusage.h                            |   20 +
 sysdeps/csky/nptl/Makefile                         |   20 +
 sysdeps/csky/nptl/bits/pthreadtypes-arch.h         |   71 +
 sysdeps/csky/nptl/bits/semaphore.h                 |   34 +
 sysdeps/csky/nptl/pthread-offsets.h                |    5 +
 sysdeps/csky/nptl/pthreaddef.h                     |   40 +
 sysdeps/csky/nptl/tcb-offsets.sym                  |   11 +
 sysdeps/csky/nptl/tls.h                            |  179 ++
 sysdeps/csky/preconfigure                          |    4 +
 sysdeps/csky/setjmp.S                              |  113 ++
 sysdeps/csky/sfp-machine.h                         |   50 +
 sysdeps/csky/sotruss-lib.c                         |   49 +
 sysdeps/csky/stackinfo.h                           |   32 +
 sysdeps/csky/start.S                               |  133 ++
 sysdeps/csky/strcmp.S                              |  336 ++++
 sysdeps/csky/strcpy.S                              |  273 +++
 sysdeps/csky/sys/ucontext.h                        |  116 ++
 sysdeps/csky/sysdep.h                              |   45 +
 sysdeps/csky/tls-macros.h                          |  106 +
 sysdeps/csky/tst-audit.h                           |   23 +
 sysdeps/unix/csky/abiv2_sysdep.S                   |   63 +
 sysdeps/unix/csky/sysdep.S                         |   74 +
 sysdeps/unix/csky/sysdep.h                         |   26 +
 sysdeps/unix/sysv/linux/csky/Implies               |    4 +
 sysdeps/unix/sysv/linux/csky/Makefile              |   26 +
 sysdeps/unix/sysv/linux/csky/Versions              |   34 +
 sysdeps/unix/sysv/linux/csky/____longjmp_chk.S     |  129 ++
 sysdeps/unix/sysv/linux/csky/abiv2_brk.c           |   56 +
 sysdeps/unix/sysv/linux/csky/abiv2_clone.S         |  106 +
 sysdeps/unix/sysv/linux/csky/abiv2_getcontext.S    |   72 +
 sysdeps/unix/sysv/linux/csky/abiv2_setcontext.S    |   95 +
 sysdeps/unix/sysv/linux/csky/abiv2_syscall.S       |   68 +
 sysdeps/unix/sysv/linux/csky/abiv2_vfork.S         |   45 +
 sysdeps/unix/sysv/linux/csky/bits/fcntl.h          |   55 +
 sysdeps/unix/sysv/linux/csky/bits/mman.h           |   42 +
 sysdeps/unix/sysv/linux/csky/bits/shm.h            |  103 +
 sysdeps/unix/sysv/linux/csky/brk.c                 |   61 +
 sysdeps/unix/sysv/linux/csky/c++-types.data        |   67 +
 sysdeps/unix/sysv/linux/csky/clone.S               |   99 +
 sysdeps/unix/sysv/linux/csky/configure             |    5 +
 sysdeps/unix/sysv/linux/csky/configure.ac          |    6 +
 sysdeps/unix/sysv/linux/csky/csky_readtp.h         |   24 +
 sysdeps/unix/sysv/linux/csky/ftruncate64.c         |   41 +
 sysdeps/unix/sysv/linux/csky/getcontext.S          |  108 +
 sysdeps/unix/sysv/linux/csky/ipc_priv.h            |   21 +
 sysdeps/unix/sysv/linux/csky/jmp_buf-macros.h      |    6 +
 sysdeps/unix/sysv/linux/csky/kernel-features.h     |   29 +
 sysdeps/unix/sysv/linux/csky/ld.abilist            |   10 +
 sysdeps/unix/sysv/linux/csky/ldconfig.h            |   24 +
 .../unix/sysv/linux/csky/libBrokenLocale.abilist   |    2 +
 sysdeps/unix/sysv/linux/csky/libanl.abilist        |    5 +
 sysdeps/unix/sysv/linux/csky/libc-read_tp.S        |    1 +
 sysdeps/unix/sysv/linux/csky/libc.abilist          | 2084 ++++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/libcrypt.abilist      |    8 +
 sysdeps/unix/sysv/linux/csky/libdl.abilist         |   10 +
 sysdeps/unix/sysv/linux/csky/libm.abilist          |  737 +++++++
 sysdeps/unix/sysv/linux/csky/libnsl.abilist        |  121 ++
 sysdeps/unix/sysv/linux/csky/libpthread.abilist    |  217 ++
 sysdeps/unix/sysv/linux/csky/libresolv.abilist     |   80 +
 sysdeps/unix/sysv/linux/csky/librt.abilist         |   36 +
 sysdeps/unix/sysv/linux/csky/libthread_db.abilist  |   41 +
 sysdeps/unix/sysv/linux/csky/libutil.abilist       |    7 +
 sysdeps/unix/sysv/linux/csky/makecontext.c         |   81 +
 sysdeps/unix/sysv/linux/csky/profil-counter.h      |   34 +
 sysdeps/unix/sysv/linux/csky/pt-vfork.S            |    1 +
 sysdeps/unix/sysv/linux/csky/read_tp.S             |   46 +
 sysdeps/unix/sysv/linux/csky/readahead.c           |   34 +
 sysdeps/unix/sysv/linux/csky/register-dump.h       |  218 ++
 sysdeps/unix/sysv/linux/csky/scandir64.c           |    1 +
 sysdeps/unix/sysv/linux/csky/setcontext.S          |  128 ++
 sysdeps/unix/sysv/linux/csky/shlib-versions        |    3 +
 sysdeps/unix/sysv/linux/csky/sigcontextinfo.h      |   37 +
 sysdeps/unix/sysv/linux/csky/swapcontext.S         |  112 ++
 sysdeps/unix/sysv/linux/csky/sys/cachectl.h        |   35 +
 sysdeps/unix/sysv/linux/csky/sys/procfs.h          |  123 ++
 sysdeps/unix/sysv/linux/csky/sys/ucontext.h        |  111 ++
 sysdeps/unix/sysv/linux/csky/sys/user.h            |   65 +
 sysdeps/unix/sysv/linux/csky/syscall.S             |   61 +
 sysdeps/unix/sysv/linux/csky/syscalls.list         |    7 +
 sysdeps/unix/sysv/linux/csky/sysdep.S              |  110 ++
 sysdeps/unix/sysv/linux/csky/sysdep.h              |  757 +++++++
 sysdeps/unix/sysv/linux/csky/ucontext_i.sym        |   31 +
 140 files changed, 13741 insertions(+), 3 deletions(-)
 create mode 100644 sysdeps/csky/Implies
 create mode 100644 sysdeps/csky/Makefile
 create mode 100644 sysdeps/csky/__longjmp.S
 create mode 100644 sysdeps/csky/abort-instr.h
 create mode 100644 sysdeps/csky/atomic-machine.h
 create mode 100644 sysdeps/csky/backtrace.c
 create mode 100644 sysdeps/csky/bits/endian.h
 create mode 100644 sysdeps/csky/bits/fenv.h
 create mode 100644 sysdeps/csky/bits/link.h
 create mode 100644 sysdeps/csky/bits/setjmp.h
 create mode 100644 sysdeps/csky/bsd-_setjmp.S
 create mode 100644 sysdeps/csky/bsd-setjmp.S
 create mode 100644 sysdeps/csky/configure
 create mode 100644 sysdeps/csky/configure.ac
 create mode 100644 sysdeps/csky/crti.S
 create mode 100644 sysdeps/csky/crtn.S
 create mode 100644 sysdeps/csky/csky-mcount.S
 create mode 100644 sysdeps/csky/dl-machine.h
 create mode 100644 sysdeps/csky/dl-procinfo.c
 create mode 100644 sysdeps/csky/dl-procinfo.h
 create mode 100644 sysdeps/csky/dl-sysdep.h
 create mode 100644 sysdeps/csky/dl-tls.h
 create mode 100644 sysdeps/csky/dl-tlsdesc.h
 create mode 100644 sysdeps/csky/dl-trampoline.S
 create mode 100644 sysdeps/csky/fenv_private.h
 create mode 100644 sysdeps/csky/fpu/fclrexcpt.c
 create mode 100644 sysdeps/csky/fpu/fedisblxcpt.c
 create mode 100644 sysdeps/csky/fpu/feenablxcpt.c
 create mode 100644 sysdeps/csky/fpu/fegetenv.c
 create mode 100644 sysdeps/csky/fpu/fegetexcept.c
 create mode 100644 sysdeps/csky/fpu/fegetmode.c
 create mode 100644 sysdeps/csky/fpu/fegetround.c
 create mode 100644 sysdeps/csky/fpu/feholdexcpt.c
 create mode 100644 sysdeps/csky/fpu/fenv_libc.h
 create mode 100644 sysdeps/csky/fpu/fesetenv.c
 create mode 100644 sysdeps/csky/fpu/fesetexcept.c
 create mode 100644 sysdeps/csky/fpu/fesetmode.c
 create mode 100644 sysdeps/csky/fpu/fesetround.c
 create mode 100644 sysdeps/csky/fpu/feupdateenv.c
 create mode 100644 sysdeps/csky/fpu/fgetexcptflg.c
 create mode 100644 sysdeps/csky/fpu/fraiseexcpt.c
 create mode 100644 sysdeps/csky/fpu/fsetexcptflg.c
 create mode 100644 sysdeps/csky/fpu/ftestexcept.c
 create mode 100644 sysdeps/csky/fpu_control.h
 create mode 100644 sysdeps/csky/gccframe.h
 create mode 100644 sysdeps/csky/jmpbuf-unwind.h
 create mode 100644 sysdeps/csky/ldsodefs.h
 create mode 100644 sysdeps/csky/libc-tls.c
 create mode 100644 sysdeps/csky/libm-test-ulps
 create mode 100644 sysdeps/csky/libm-test-ulps-name
 create mode 100644 sysdeps/csky/linkmap.h
 create mode 100644 sysdeps/csky/machine-gmon.h
 create mode 100644 sysdeps/csky/macro.S
 create mode 100644 sysdeps/csky/math-tests.h
 create mode 100644 sysdeps/csky/math_private.h
 create mode 100644 sysdeps/csky/memcpy.S
 create mode 100644 sysdeps/csky/memusage.h
 create mode 100644 sysdeps/csky/nptl/Makefile
 create mode 100644 sysdeps/csky/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/csky/nptl/bits/semaphore.h
 create mode 100644 sysdeps/csky/nptl/pthread-offsets.h
 create mode 100644 sysdeps/csky/nptl/pthreaddef.h
 create mode 100644 sysdeps/csky/nptl/tcb-offsets.sym
 create mode 100644 sysdeps/csky/nptl/tls.h
 create mode 100644 sysdeps/csky/preconfigure
 create mode 100644 sysdeps/csky/setjmp.S
 create mode 100644 sysdeps/csky/sfp-machine.h
 create mode 100644 sysdeps/csky/sotruss-lib.c
 create mode 100644 sysdeps/csky/stackinfo.h
 create mode 100644 sysdeps/csky/start.S
 create mode 100644 sysdeps/csky/strcmp.S
 create mode 100644 sysdeps/csky/strcpy.S
 create mode 100644 sysdeps/csky/sys/ucontext.h
 create mode 100644 sysdeps/csky/sysdep.h
 create mode 100644 sysdeps/csky/tls-macros.h
 create mode 100644 sysdeps/csky/tst-audit.h
 create mode 100644 sysdeps/unix/csky/abiv2_sysdep.S
 create mode 100644 sysdeps/unix/csky/sysdep.S
 create mode 100644 sysdeps/unix/csky/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/Implies
 create mode 100644 sysdeps/unix/sysv/linux/csky/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/csky/Versions
 create mode 100644 sysdeps/unix/sysv/linux/csky/____longjmp_chk.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2_brk.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2_clone.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2_getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2_setcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2_syscall.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2_vfork.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/bits/fcntl.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/bits/mman.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/bits/shm.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/brk.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/csky/clone.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/configure
 create mode 100644 sysdeps/unix/sysv/linux/csky/configure.ac
 create mode 100644 sysdeps/unix/sysv/linux/csky/csky_readtp.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/ftruncate64.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/ipc_priv.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/kernel-features.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/ldconfig.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/libBrokenLocale.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libanl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libc-read_tp.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/libc.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libcrypt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libdl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libm.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libnsl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libpthread.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libresolv.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/librt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libthread_db.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/libutil.abilist
 create mode 100644 sysdeps/unix/sysv/linux/csky/makecontext.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/profil-counter.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/pt-vfork.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/read_tp.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/readahead.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/register-dump.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/scandir64.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/setcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/csky/sigcontextinfo.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/swapcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/sys/cachectl.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/sys/procfs.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/sys/ucontext.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/sys/user.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/syscall.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/csky/sysdep.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/ucontext_i.sym

Comments

Florian Weimer April 8, 2018, 7:50 a.m. UTC | #1
* Mao Han:

> CK610 is the second-generation CPU of CSKY, fullycompatible with M*Core.
> CK807/CK810 bases on C-SKY V2 instruction set architecture and 16/32-bit
> variable length instruction. Including basic core(CK807/CK810),
> floating-point enhancement(CK807F/CK810F), multimedia enhancement (CK810D)
> and multiple-processing extension (CK807MP/CK810MP).

Which ABIs of those do you intend to support?

These should be added to the README file.
=?UTF-8?B?5q+b5pmX?= April 8, 2018, 8:29 a.m. UTC | #2
On Sun, Apr 08, 2018 at 09:50:16AM +0200, Florian Weimer wrote:
Hi,
> * Mao Han:
> 
> > CK610 is the second-generation CPU of CSKY, fullycompatible with M*Core.
> > CK807/CK810 bases on C-SKY V2 instruction set architecture and 16/32-bit
> > variable length instruction. Including basic core(CK807/CK810),
> > floating-point enhancement(CK807F/CK810F), multimedia enhancement (CK810D)
> > and multiple-processing extension (CK807MP/CK810MP).
> 
> Which ABIs of those do you intend to support?
> 
> These should be added to the README file.

Thanks for comment.
In glibc and linux we only cares about following cpu and extensions. 

    ck610 only  have: ck610
    ck807 could have: ck807 ck807f ck807vf ck807ef
    ck810 could have: ck810 ck810f ck810vf ck810ef
    ck860 could have: ck860 ck860f ck860vf
  f: means FPU co-processor
  v: means VDSP co-processor just like "ARM-NEON"
  e: is our old DSP co-processor which use HI-LO regs for operation. In
  current ck807/ck810 they default have HI-LO regs.
 
For this patch-set, we support:
   ck610
  (ck807/ck807f/ck807ef)
  (ck810/ck810e/ck810ef)

ck6** use csky-*-linux-gnuabiv1, ck8** use csky-*-linux-gnuabiv2
I will update the introduction for these.
 
It seems only this need be added to the README file. Is that correct?
        csky-*-linux-gnuabi

Best Regards
  Mao Han
Florian Weimer April 9, 2018, 8:43 a.m. UTC | #3
On 04/08/2018 10:29 AM, Mao Han wrote:
> On Sun, Apr 08, 2018 at 09:50:16AM +0200, Florian Weimer wrote:
> Hi,
>> * Mao Han:
>>
>>> CK610 is the second-generation CPU of CSKY, fullycompatible with M*Core.
>>> CK807/CK810 bases on C-SKY V2 instruction set architecture and 16/32-bit
>>> variable length instruction. Including basic core(CK807/CK810),
>>> floating-point enhancement(CK807F/CK810F), multimedia enhancement (CK810D)
>>> and multiple-processing extension (CK807MP/CK810MP).
>>
>> Which ABIs of those do you intend to support?
>>
>> These should be added to the README file.
> 
> Thanks for comment.
> In glibc and linux we only cares about following cpu and extensions.
> 
>      ck610 only  have: ck610
>      ck807 could have: ck807 ck807f ck807vf ck807ef
>      ck810 could have: ck810 ck810f ck810vf ck810ef
>      ck860 could have: ck860 ck860f ck860vf
>    f: means FPU co-processor
>    v: means VDSP co-processor just like "ARM-NEON"
>    e: is our old DSP co-processor which use HI-LO regs for operation. In
>    current ck807/ck810 they default have HI-LO regs.
>   
> For this patch-set, we support:
>     ck610
>    (ck807/ck807f/ck807ef)
>    (ck810/ck810e/ck810ef)
> 
> ck6** use csky-*-linux-gnuabiv1, ck8** use csky-*-linux-gnuabiv2
> I will update the introduction for these.
>   
> It seems only this need be added to the README file. Is that correct?
>          csky-*-linux-gnuabi

It's still not clear to me whether you intend to support more than one 
ABI (there is a __CSKYABIV2__ preprocessor conditional in the 
submission, for example).

If you support multiple ABIs, won't you need different target triplets?

Thanks,
Florian
=?UTF-8?B?5q+b5pmX?= April 9, 2018, 9:05 a.m. UTC | #4
Hi,
> It's still not clear to me whether you intend to support more than one ABI
> (there is a __CSKYABIV2__ preprocessor conditional in the submission, for
> example).
> 
> If you support multiple ABIs, won't you need different target triplets?
>
Two ABIs are supported. csky abiv1 and csky abiv2. In target triplets
it is distinguish by the ABI section in csky-vendor-linux-libc[ABI].

Best Regards
  Mao Han
Joseph Myers April 17, 2018, 8:43 p.m. UTC | #5
When maintaining or submitting a new glibc port, it is strongly advisable 
to read recent reviews of other glibc ports, because there are many issues 
relating to current good practice in glibc ports that are relevant to any 
new port submission, and so by studying the past reviews you can avoid 
your port suffering from the same problems as the previous ports.  Thus, 
you should read all the reviews in the past year or so of the ARC port and 
of many versions of the RISC-V port, and address the issues in the next 
version of this port, where relevant to it.

In addition, it is important when maintaining a port out of tree to ensure 
that you keep monitoring global glibc changes made across ports and keep 
your port up to date for such global changes.  Such fixes to update the 
port for such global changes are an important part of the work Sandra has 
done to prepare the binutils and GCC ports for upstream submission.

The following are a very non-exhaustive list of such generic issues that I 
believe are applicable to this port.  I expect there are others that can 
be found by a more detailed study of the ARC and RISC-V reviews.


1. Any glibc port submission needs to include the results of running the 
glibc testsuite, for all the main supported configurations of the port.  
This means the full testsuite, both compilation and execution tests.  It 
may be run natively, or you may use cross testing using test-wrapper.

The final part of the "make check" output, listing all non-PASS/XFAIL 
tests and statistics of different test results, needs to be included in 
the port submission.  It's desirable to provide a tarball of .out / 
.test-result files for all such tests, and the full "make check" output, 
somewhere external from where people can download it to study the results 
in more detail - but the basic summary, for each of the main supported 
configurations, needs to be included in the port submission.

Furthermore, the results that are relevant are, as I said in ARC port 
discussions, results with *upstream* versions of the other components, not 
some version that may be on GitHub or elsewhere.  That means upstream 
Linux, binutils, GCC - or, until the ports are upstream, the latest 
versions submitted upstream or being prepared for upstream.

Since all the ABIv1 support is being removed as part of preparing the GCC 
port for upstream, that means no ABIv1 support should be included anywhere 
in the glibc port.  It's OK to have #if or similar conditionals with 
#error in the ABIv1 case, but not anything more than errors for ABIv1.  
This is exactly analogous to the case of 32-bit RISC-V: because the kernel 
support for 32-bit RISC-V was not ready when the glibc port went in, all 
such support was removed in the glibc port or turned into #errors.  If in 
future the kernel support for 32-bit RISC-V is good enough to run the 
glibc testsuite with reasonable results, glibc support can be added at 
that point (and much the same would apply if ABIv1 support were added to 
GCC for C-SKY in future - of course, for upstream it would need to be 
cleanly implemented with appropriate -m options for selecting the ABI).

Furthermore, for a glibc port to be considered in a reasonable state for 
upstream, we expect no more than about 20 architecture-specific failures 
(you can disregard generic cross-testing failures such as listed at 
<https://sourceware.org/glibc/wiki/Release/2.27>).


2. Any glibc port needs to add appropriate configurations to 
build-many-glibcs.py.  These should cover all the different ABIs supported 
by the port, and any other significant variations.  When using the latest 
upstream versions of all components, these configurations must pass 
compilers / glibcs builds - there must be no compilation test failures for 
the new configurations whatever.

I don't believe the present port would pass the compilation parts of the 
testsuite.  For example, your sys/ucontext.h headers include headers they 
should not include and define names that are not permitted to be defined, 
without any __USE_MISC etc. conditionals as in other such headers.  (This 
is also an example of something that would have shown up in monitoring 
global glibc changes to keep your port up to date with them.)


3. The minimum symbol version needs to be GLIBC_2.28 at present.  If the 
kernel port isn't upstream in the next few months, then the glibc port 
can't go upstream in that time either, so you'll need a corresponding 
later minimum symbol version.


4. arch_minimum_kernel has to reflect the kernel version in which the 
support goes upstream.  That's certainly not 2.6.25.  Since the support 
didn't get into 4.17-rc1, presumably it needs to be 4.18.0 or later, and 
to keep being updated until the kernel support is upstream.


5. New ports should have ABI-specific dynamic linker names - a different 
name for each supported ABI variant, different from those used on all 
other architectures, to support systems using multi-arch directory 
arrangements.  For example, ld-linux-csky-{be,le}.so.1 (since you seem to 
support both endiannesses) might be appropriate, but not ld.so.1 which you 
currently have in shlib-versions (and not ld-linux.so.2 which you 
currently have in a bogus entry in ldconfig.h).  If there are other 
relevant ABI variants beyond endianness, those should be allowed for in 
the dynamic linker names.  You should give a more detailed explanation of 
what variants are or are not ABI compatible to justify the particular 
choice of what gets a separate dynamic linker name.

This of course needs coordinating with the GCC port so it passes 
appropriate -dynamic-linker options to ld.


6. Many files are missing the one-line description on the first line of 
the file before the copyright notice.


The following are more specific to this port:


7. There should be no abiv2_* files.  If ABIv1 were supported, the sysdeps 
mechanism would need to be used with abiv1/ and abiv2/ subdirectories to 
select appropriate files.


8. You have *_vfp* function names and references to VFP in comments.  Is 
VFP really the name of the floating-point unit for this architecture?  If 
not, this is cargo-culted from ARM and needs to be fixed (likewise, the 
comments in math-tests.h may not be correct for this architecture).


9. You have __csky_hard_float__ conditionals in sysdeps/csky/fpu/ files.  
That makes no sense.  If you have a proper with_fp_cond setting (see about 
monitoring global changes, again), then fpu/ files shouldn't be used at 
all for soft float.  That means you can remove those conditionals and just 
rely on the default math/ fallback implementations of fenv.h functions.

Such conditionals are still relevant in *installed* headers, but not in 
fpu/ files.


10. Existing practice in glibc is that where you have e.g. FE_DENORMAL, 
such architecture-specific values are only defined in the implementation 
namespace (e.g. __FE_DENORM in sysdeps/x86/fpu/bits/fenv.h) and are *not* 
included in FE_ALL_EXCEPT.
Joseph Myers April 26, 2018, 11:45 a.m. UTC | #6
This message didn't reach the libc-alpha list because of the large 
attachments.  There's a message size limit (a few hundred kB?); the 
detailed test logs need to go somewhere external to which you include the 
URL when sending the next port version (the list of FAILs and summary of 
results should still be included directly in the message to libc-alpha).

On Thu, 26 Apr 2018, Mao Han wrote:

> Got two fail on build check, elf/check-textrel seems caused by our gcc
> tools. elf/check-localplt says matherr is missing as 
> # define LIBM_SVID_COMPAT SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_27)
> and I use GLIBC_2_28. 135 fails in math, and 64 others. I haven't

You need to add a localplt.data file, like for RISC-V.

> The hard-float result is much worse. Got 1.8k fails in math. Seems 
> most of them are precision problems.

First try truncating your libm-test-ulps file and regenerating with "make 
regen-ulps", to make sure it's up to date with current sources and tests.

> > Since all the ABIv1 support is being removed as part of preparing the GCC 
> > port for upstream, that means no ABIv1 support should be included anywhere 
> > in the glibc port.  It's OK to have #if or similar conditionals with 
> > #error in the ABIv1 case, but not anything more than errors for ABIv1.  
> > This is exactly analogous to the case of 32-bit RISC-V: because the kernel 
> > support for 32-bit RISC-V was not ready when the glibc port went in, all 
> > such support was removed in the glibc port or turned into #errors.  If in 
> > future the kernel support for 32-bit RISC-V is good enough to run the 
> > glibc testsuite with reasonable results, glibc support can be added at 
> > that point (and much the same would apply if ABIv1 support were added to 
> > GCC for C-SKY in future - of course, for upstream it would need to be 
> > cleanly implemented with appropriate -m options for selecting the ABI).
> > 
> As ABIv1 is widely used by our customers ,and included in our linux kernel
> upstream. I need to keep working on a port with ABIv1 and ABIv2. I will
> remove the ABIv1 part next time I send the patch.

Obviously you can have your own branch that adds ABIv1 support - but the 
presumption is it only goes upstream if and when the binutils / GCC 
support is upstream, and has the symbol version of the next glibc release 
at that time (just as if 32-bit RISC-V support goes into glibc, it will 
have GLIBC_2.28 or later minimum symbol version, not the GLIBC_2.27 
version used for 64-bit RISC-V).