mbox series

[v4,00/13] port C-SKY to glibc

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

Message

=?UTF-8?B?5q+b5pmX?= Sept. 12, 2018, 2:56 a.m. UTC
It is the fourth patchset for C-SKY port. Base on commit
38245425a9add7bd22f8732219e0085432f223b6 (6 sep). Two abi combinations
are supported with this patch: C-SKY ABIV2 with (soft float & little endian,
hard float & little endian). CK807(ef), CK810(ef), CK860 are the
accroding supported processor cores to the C-SKY V2 abi;
f stands for FPU co-processor; e stands for DSP co-processor. Our
gcc and binutils support have already been merge to the gnu trunck.
The fourth linux csky support patchset has been post to kernel.org last
week, seems will ready in several weeks. This patchset is tested
with gcc(9.0), binutil(2.31), linux(4.18), GCC and Binutils are from
the official respository:
 
1. GCC commit:
be2d111a878e1422c921226bc7714131a5c470fa
2. Binutils commit:
316828699127cc855cf06cbfaee096f6fa75bba4
3. Linux git repo path
https://github.com/c-sky/csky-linux

CSKY V2 ABI manual:
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf

CSKY architecture user guide:
https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf

IFUNC, ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA, static PIE is not support
with this patchset.

Several patches will be post to GCC and Binutils to fix some testcase fail
later this month, while the follow results have these patches applied.
 
The patchset is cross-tested with qemu system mode as I have no board
with enough memory or can caculate subnormal.

C-SKY ABIV2 soft float little endian:
UNSUPPORTED: crypt/cert
FAIL: malloc/tst-malloc-usable-tunables
UNSUPPORTED: malloc/tst-mallocstate
UNSUPPORTED: math/test-fesetexcept-traps
UNSUPPORTED: math/test-fexcept-traps
UNSUPPORTED: math/test-matherr
UNSUPPORTED: math/test-matherr-2
UNSUPPORTED: math/test-nearbyint-except
UNSUPPORTED: math/test-nearbyint-except-2
UNSUPPORTED: misc/tst-ofdlocks-compat
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: misc/tst-ttyname
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nptl/tst-_res1
FAIL: nptl/tst-thread_local1
UNSUPPORTED: nss/tst-nss-test3
UNSUPPORTED: posix/tst-glob_lstat_compat
UNSUPPORTED: posix/tst-spawn4-compat
UNSUPPORTED: posix/tst-sysconf-empty-chroot
UNSUPPORTED: resolv/tst-p_secstodate
UNSUPPORTED: resolv/tst-resolv-ai_idn
UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
UNSUPPORTED: resolv/tst-resolv-res_init
UNSUPPORTED: resolv/tst-resolv-res_init-thread
UNSUPPORTED: resolv/tst-resolv-threads
UNSUPPORTED: stdlib/test-bz22786
UNSUPPORTED: string/test-bcopy
UNSUPPORTED: string/test-memmove
FAIL: sunrpc/bug20790
UNSUPPORTED: time/tst-y2039
Summary of test results:
      4 FAIL
   5004 PASS
     31 UNSUPPORTED
     19 XFAIL

C-SKY ABIV2 hard float little endian:
UNSUPPORTED: crypt/cert
FAIL: malloc/tst-malloc-usable-tunables
UNSUPPORTED: malloc/tst-mallocstate
FAIL: math/test-double-tgamma
FAIL: math/test-float-tgamma
FAIL: math/test-float32-tgamma
FAIL: math/test-float32x-tgamma
FAIL: math/test-float64-tgamma
FAIL: math/test-ldouble-tgamma
UNSUPPORTED: math/test-matherr
UNSUPPORTED: math/test-matherr-2
UNSUPPORTED: misc/tst-ofdlocks-compat
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: misc/tst-ttyname
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nptl/tst-_res1
FAIL: nptl/tst-thread_local1
UNSUPPORTED: nss/tst-nss-test3
UNSUPPORTED: posix/tst-glob_lstat_compat
UNSUPPORTED: posix/tst-spawn4-compat
UNSUPPORTED: posix/tst-sysconf-empty-chroot
UNSUPPORTED: resolv/tst-p_secstodate
UNSUPPORTED: resolv/tst-resolv-ai_idn
UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
UNSUPPORTED: resolv/tst-resolv-res_init
UNSUPPORTED: resolv/tst-resolv-res_init-thread
UNSUPPORTED: resolv/tst-resolv-threads
UNSUPPORTED: stdlib/test-bz22786
UNSUPPORTED: string/test-bcopy
UNSUPPORTED: string/test-memmove
FAIL: sunrpc/bug20790
UNSUPPORTED: time/tst-y2039
Summary of test results:
     10 FAIL
   5001 PASS
     27 UNSUPPORTED
     19 XFAIL

Detail result:
https://github.com/c-sky/test-result/blob/master/glibc/glibc_2.28_patch_v4_807_test_result.tar.gz
https://github.com/c-sky/test-result/blob/master/glibc/glibc_2.28_patch_v4_807f_test_result.tar.gz
https://github.com/c-sky/test-result/blob/master/glibc/glibc_2.28_patch_v4_build_many_log.tar.gz
 
FAIL cases:
1. nptl/tst-thread_local1
   seems lack c++ support, the gcc frountend can not generate constructor
   and destructor for static, anonymous_namespace and extern variables.

2. sunrpc/bug20790
   It fails because the testing environment lacks native cpp.

3. malloc/tst-malloc-usable-tunables
   It fails because liunx use mmap to alloc space for vdso and cause brk
   fail. Wait for our linux kernel to fix it.

4. nptl/tst-_res1
   It fails because symbol _res is incorrect linked.

5. The following cases fail due to gcc optimize change the sequence of
   -a * b to -(a * b) and got 1ulps error.
   math/test-double-tgamma
   math/test-float-tgamma
   math/test-float32-tgamma
   math/test-float32x-tgamma
   math/test-float64-tgamma
   math/test-ldouble-tgamma

6. The following three cases some time get into deadlock when the child
   return before the parent thread start to wait. I don know what is
   the expect behaviour under this condition.
   misc/tst-clone3
   tst-mallocfork
   tst-mallocfork2
 
Changes since v3:
  - update the abilist
  - update ulps
  - update version to 2.29
  - coding style and conventions
  - cleanup unnecessary linux syscall
  - remove support for big endian
  - fix hard float exception handle
  - assembly optimize memcopy, memmove, ...  with vdsp and byte extract
    instruction. our hardware can ld/st word form unalign address directly.

Changes since v2:
  - update the abilist
  - update ulps
  - cleanup unnecessary linux syscall
  - remove support for ABIV1
  - add one-line description for many files
  - put ABIV2 code into seperate folder
  - cleanup ucontext.h namespace
  - cleanup linux/csky/Version
  - add with_fp_cond support to distinguish soft float
  - remove PF_X in stackinfo
  - add abi check in preconfigure
  - support build-many-glibcs.py
  - fix pointer guard acquisition
 
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 (12):
  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: Linux ABI
  C-SKY: ABI Lists
  C-SKY: Linux Startup and Dynamic Loading Code
  C-SKY: Build Infastructure
  C-SKY: Add build-many-glibcs.py support
  C-SKY: Skeleton documentation

Mao Han (13):
  C-SKY: ABI related code
  C-SKY: TLS support
  C-SKY: Math support
  C-SKY: NPTL support and Atomic
  C-SKY: Linux Syscall Interface
  C-SKY: Linux ABI
  C-SKY: ABI Lists
  C-SKY: Linux Startup and Dynamic Loading Code
  C-SKY: Add dynamic relocations to elf.h
  C-SKY: Build Infastructure
  C-SKY: Add ABI definitions in config.h.in
  C-SKY: Add build-many-glibcs.py support
  C-SKY: Skeleton documentation

 ChangeLog                                          |  154 ++
 NEWS                                               |    6 +
 README                                             |    1 +
 config.h.in                                        |    6 +
 elf/elf.h                                          |   67 +-
 scripts/build-many-glibcs.py                       |    8 +
 sysdeps/csky/Implies                               |    4 +
 sysdeps/csky/Makefile                              |   13 +
 sysdeps/csky/abiv2/__longjmp.S                     |   61 +
 sysdeps/csky/abiv2/crti.S                          |   99 +
 sysdeps/csky/abiv2/crtn.S                          |   50 +
 sysdeps/csky/abiv2/csky-mcount.S                   |   72 +
 sysdeps/csky/abiv2/dl-trampoline.S                 |   50 +
 sysdeps/csky/abiv2/memcmp.S                        |  142 ++
 sysdeps/csky/abiv2/memcpy.S                        |  224 +++
 sysdeps/csky/abiv2/memmove.S                       |    1 +
 sysdeps/csky/abiv2/memset.S                        |   98 +
 sysdeps/csky/abiv2/setjmp.S                        |   77 +
 sysdeps/csky/abiv2/start.S                         |  109 +
 sysdeps/csky/abiv2/strcmp.S                        |  156 ++
 sysdeps/csky/abiv2/strcpy.S                        |  127 ++
 sysdeps/csky/abiv2/strlen.S                        |  102 +
 sysdeps/csky/abiv2/tls-macros.h                    |   55 +
 sysdeps/csky/abort-instr.h                         |    2 +
 sysdeps/csky/atomic-machine.h                      |   77 +
 sysdeps/csky/bits/endian.h                         |    6 +
 sysdeps/csky/bits/fenv.h                           |   92 +
 sysdeps/csky/bits/link.h                           |   55 +
 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/dl-machine.h                          |  362 ++++
 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/fpu/fclrexcpt.c                       |   42 +
 sysdeps/csky/fpu/fedisblxcpt.c                     |   41 +
 sysdeps/csky/fpu/feenablxcpt.c                     |   40 +
 sysdeps/csky/fpu/fegetenv.c                        |   37 +
 sysdeps/csky/fpu/fegetexcept.c                     |   32 +
 sysdeps/csky/fpu/fegetmode.c                       |   28 +
 sysdeps/csky/fpu/fegetround.c                      |   34 +
 sysdeps/csky/fpu/feholdexcpt.c                     |   34 +
 sysdeps/csky/fpu/fenv_libc.h                       |   30 +
 sysdeps/csky/fpu/fenv_private.h                    |  280 +++
 sysdeps/csky/fpu/fesetenv.c                        |   59 +
 sysdeps/csky/fpu/fesetexcept.c                     |   33 +
 sysdeps/csky/fpu/fesetmode.c                       |   33 +
 sysdeps/csky/fpu/fesetround.c                      |   32 +
 sysdeps/csky/fpu/feupdateenv.c                     |   46 +
 sysdeps/csky/fpu/fgetexcptflg.c                    |   32 +
 sysdeps/csky/fpu/fix-fp-int-convert-overflow.h     |   33 +
 sysdeps/csky/fpu/fpu_control.h                     |  109 +
 sysdeps/csky/fpu/fraiseexcpt.c                     |  126 ++
 sysdeps/csky/fpu/fsetexcptflg.c                    |   43 +
 sysdeps/csky/fpu/ftestexcept.c                     |   30 +
 sysdeps/csky/fpu/libm-test-ulps                    | 1640 +++++++++++++++
 sysdeps/csky/fpu/libm-test-ulps-name               |    1 +
 sysdeps/csky/gccframe.h                            |   21 +
 sysdeps/csky/jmpbuf-unwind.h                       |   48 +
 sysdeps/csky/ldsodefs.h                            |   42 +
 sysdeps/csky/libc-tls.c                            |   32 +
 sysdeps/csky/linkmap.h                             |    4 +
 sysdeps/csky/machine-gmon.h                        |   32 +
 sysdeps/csky/math-tests-trap.h                     |   26 +
 sysdeps/csky/memusage.h                            |   21 +
 sysdeps/csky/nofpu/Implies                         |    1 +
 sysdeps/csky/nofpu/libm-test-ulps                  | 1694 ++++++++++++++++
 sysdeps/csky/nofpu/libm-test-ulps-name             |    1 +
 sysdeps/csky/nofpu/math-tests-exceptions.h         |   27 +
 sysdeps/csky/nofpu/math-tests-rounding.h           |   27 +
 sysdeps/csky/nptl/Makefile                         |   20 +
 sysdeps/csky/nptl/bits/pthreadtypes-arch.h         |   70 +
 sysdeps/csky/nptl/bits/semaphore.h                 |   35 +
 sysdeps/csky/nptl/pthread-offsets.h                |    5 +
 sysdeps/csky/nptl/pthreaddef.h                     |   32 +
 sysdeps/csky/nptl/tcb-offsets.sym                  |   10 +
 sysdeps/csky/nptl/tls.h                            |  156 ++
 sysdeps/csky/preconfigure                          |   33 +
 sysdeps/csky/sfp-machine.h                         |   50 +
 sysdeps/csky/sotruss-lib.c                         |   49 +
 sysdeps/csky/stackinfo.h                           |   29 +
 sysdeps/csky/sysdep.h                              |   88 +
 sysdeps/csky/tininess.h                            |    1 +
 sysdeps/csky/tst-audit.h                           |   23 +
 sysdeps/unix/sysv/linux/csky/Implies               |    3 +
 sysdeps/unix/sysv/linux/csky/Makefile              |    8 +
 sysdeps/unix/sysv/linux/csky/Versions              |    5 +
 .../unix/sysv/linux/csky/abiv2/____longjmp_chk.S   |   81 +
 sysdeps/unix/sysv/linux/csky/abiv2/clone.S         |   94 +
 sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S    |   73 +
 sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S    |   96 +
 sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S   |   78 +
 sysdeps/unix/sysv/linux/csky/abiv2/syscall.S       |   67 +
 sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S        |   65 +
 sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym  |   32 +
 sysdeps/unix/sysv/linux/csky/bits/mman.h           |   44 +
 sysdeps/unix/sysv/linux/csky/bits/shm.h            |  104 +
 sysdeps/unix/sysv/linux/csky/c++-types.data        |   67 +
 sysdeps/unix/sysv/linux/csky/configure             |    4 +
 sysdeps/unix/sysv/linux/csky/configure.ac          |    5 +
 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     |   23 +
 sysdeps/unix/sysv/linux/csky/ld.abilist            |    9 +
 sysdeps/unix/sysv/linux/csky/ldconfig.h            |   31 +
 .../unix/sysv/linux/csky/libBrokenLocale.abilist   |    1 +
 sysdeps/unix/sysv/linux/csky/libanl.abilist        |    4 +
 sysdeps/unix/sysv/linux/csky/libc.abilist          | 2086 ++++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/libcrypt.abilist      |    2 +
 sysdeps/unix/sysv/linux/csky/libdl.abilist         |    9 +
 sysdeps/unix/sysv/linux/csky/libm.abilist          |  753 +++++++
 sysdeps/unix/sysv/linux/csky/libnsl.abilist        |  120 ++
 sysdeps/unix/sysv/linux/csky/libpthread.abilist    |  235 +++
 sysdeps/unix/sysv/linux/csky/libresolv.abilist     |   79 +
 sysdeps/unix/sysv/linux/csky/librt.abilist         |   35 +
 sysdeps/unix/sysv/linux/csky/libthread_db.abilist  |   40 +
 sysdeps/unix/sysv/linux/csky/libutil.abilist       |    6 +
 sysdeps/unix/sysv/linux/csky/localplt.data         |   19 +
 sysdeps/unix/sysv/linux/csky/makecontext.c         |   74 +
 sysdeps/unix/sysv/linux/csky/profil-counter.h      |   31 +
 sysdeps/unix/sysv/linux/csky/pt-vfork.S            |    1 +
 sysdeps/unix/sysv/linux/csky/register-dump.h       |  193 ++
 sysdeps/unix/sysv/linux/csky/shlib-versions        |    7 +
 sysdeps/unix/sysv/linux/csky/sigcontextinfo.h      |   32 +
 sysdeps/unix/sysv/linux/csky/sys/cachectl.h        |   38 +
 sysdeps/unix/sysv/linux/csky/sys/procfs.h          |  123 ++
 sysdeps/unix/sysv/linux/csky/sys/ucontext.h        |   89 +
 sysdeps/unix/sysv/linux/csky/sys/user.h            |   60 +
 sysdeps/unix/sysv/linux/csky/syscalls.list         |    2 +
 sysdeps/unix/sysv/linux/csky/sysdep.h              |  534 +++++
 134 files changed, 13370 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/csky/Implies
 create mode 100644 sysdeps/csky/Makefile
 create mode 100644 sysdeps/csky/abiv2/__longjmp.S
 create mode 100644 sysdeps/csky/abiv2/crti.S
 create mode 100644 sysdeps/csky/abiv2/crtn.S
 create mode 100644 sysdeps/csky/abiv2/csky-mcount.S
 create mode 100644 sysdeps/csky/abiv2/dl-trampoline.S
 create mode 100644 sysdeps/csky/abiv2/memcmp.S
 create mode 100644 sysdeps/csky/abiv2/memcpy.S
 create mode 100644 sysdeps/csky/abiv2/memmove.S
 create mode 100644 sysdeps/csky/abiv2/memset.S
 create mode 100644 sysdeps/csky/abiv2/setjmp.S
 create mode 100644 sysdeps/csky/abiv2/start.S
 create mode 100644 sysdeps/csky/abiv2/strcmp.S
 create mode 100644 sysdeps/csky/abiv2/strcpy.S
 create mode 100644 sysdeps/csky/abiv2/strlen.S
 create mode 100644 sysdeps/csky/abiv2/tls-macros.h
 create mode 100644 sysdeps/csky/abort-instr.h
 create mode 100644 sysdeps/csky/atomic-machine.h
 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/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/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/fenv_private.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/fix-fp-int-convert-overflow.h
 create mode 100644 sysdeps/csky/fpu/fpu_control.h
 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/libm-test-ulps
 create mode 100644 sysdeps/csky/fpu/libm-test-ulps-name
 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/linkmap.h
 create mode 100644 sysdeps/csky/machine-gmon.h
 create mode 100644 sysdeps/csky/math-tests-trap.h
 create mode 100644 sysdeps/csky/memusage.h
 create mode 100644 sysdeps/csky/nofpu/Implies
 create mode 100644 sysdeps/csky/nofpu/libm-test-ulps
 create mode 100644 sysdeps/csky/nofpu/libm-test-ulps-name
 create mode 100644 sysdeps/csky/nofpu/math-tests-exceptions.h
 create mode 100644 sysdeps/csky/nofpu/math-tests-rounding.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/sfp-machine.h
 create mode 100644 sysdeps/csky/sotruss-lib.c
 create mode 100644 sysdeps/csky/stackinfo.h
 create mode 100644 sysdeps/csky/sysdep.h
 create mode 100644 sysdeps/csky/tininess.h
 create mode 100644 sysdeps/csky/tst-audit.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/abiv2/____longjmp_chk.S
 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/swapcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/syscall.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym
 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/c++-types.data
 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/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.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/localplt.data
 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/register-dump.h
 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/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/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/csky/sysdep.h

Comments

Joseph Myers Sept. 12, 2018, 12:31 p.m. UTC | #1
On Wed, 12 Sep 2018, Mao Han wrote:

> 38245425a9add7bd22f8732219e0085432f223b6 (6 sep). Two abi combinations
> are supported with this patch: C-SKY ABIV2 with (soft float & little endian,
> hard float & little endian). CK807(ef), CK810(ef), CK860 are the

Could you please clarify whether those are the same ABI (compatible for 
function calling, structure layout for types from glibc headers, etc.) or 
different ABIs?

If they are different ABIs, they should have different dynamic linker 
names (of course you need to make the GCC port reflect the dynamic linker 
name used for each ABI), and your bits/fenv.h should disable most of its 
contents for soft float, like e.g. MIPS does (define only __FE_UNDEFINED 
and FE_TONEAREST as rounding modes in that case, define FE_ALL_EXCEPT to 0 
and no other exception macros, do not define FE_NOMASK_ENV).  Then you 
shouldn't need math-tests-exceptions.h and math-tests-rounding.h in the 
nofpu directory because things will be handled automatically when 
bits/fenv.h avoids defining unsupported things.

If they are the same ABI, I don't see any use for the CSKY_HARD_FLOAT 
macro defined in preconfigure; nothing seems to test it, so it's only 
relevant if shlib-versions is testing it (i.e. if they are different ABIs 
with different dynamic linker names).

Does C-SKY hard float support exception traps or not?  math-tests-trap.h 
has a comment saying not.  But you have an implementation of 
feenableexcept that implies it does support exception traps.

* If exception traps are never supported, everything related to them 
(including the definition of FE_NOMASK_ENV) should be removed; the default 
feenableexcept and fedisableexcept and fegetexcept implementations should 
suffice.

* If exception traps are always supported, your math-tests-trap.h is wrong 
and should be removed.

* If they are conditionally supported, like on Arm and AArch64, your 
math-tests-trap.h is appropriate with a different comment explaining the 
conditional support - but various fenv.h functions like feenableexcept 
need to check for the support and give errors if asked to enable 
exception traps they are unable to enable (this includes fesetenv and 
feupdateenv passed FE_NOMASK_ENV - see Arm and AArch64 for examples).

> Several patches will be post to GCC and Binutils to fix some testcase fail
> later this month, while the follow results have these patches applied.

Note that glibc ports can't go in while they depend on such non-upstream 
patches for good results (see the ARC port discussion).  You can send a 
list of all the patches required to get the given test results, but 
they'll need to be upstream (as will the Linux kernel port) before the 
port can go into glibc.

> 5. The following cases fail due to gcc optimize change the sequence of
>    -a * b to -(a * b) and got 1ulps error.
>    math/test-double-tgamma
>    math/test-float-tgamma
>    math/test-float32-tgamma
>    math/test-float32x-tgamma
>    math/test-float64-tgamma
>    math/test-ldouble-tgamma

So that needs a GCC bug fix (just like when the Arm and AArch64 ports of 
GCC used to have such a bug).
=?UTF-8?B?5q+b5pmX?= Sept. 13, 2018, 8:13 a.m. UTC | #2
On Wed, Sep 12, 2018 at 12:31:24PM +0000, Joseph Myers wrote:
> On Wed, 12 Sep 2018, Mao Han wrote:
> 
> > 38245425a9add7bd22f8732219e0085432f223b6 (6 sep). Two abi combinations
> > are supported with this patch: C-SKY ABIV2 with (soft float & little endian,
> > hard float & little endian). CK807(ef), CK810(ef), CK860 are the
> 
> Could you please clarify whether those are the same ABI (compatible for 
> function calling, structure layout for types from glibc headers, etc.) or 
> different ABIs?
>
> If they are different ABIs, they should have different dynamic linker 
> names (of course you need to make the GCC port reflect the dynamic linker 
> name used for each ABI), and your bits/fenv.h should disable most of its 
> contents for soft float, like e.g. MIPS does (define only __FE_UNDEFINED 
> and FE_TONEAREST as rounding modes in that case, define FE_ALL_EXCEPT to 0 
> and no other exception macros, do not define FE_NOMASK_ENV).  Then you 
> shouldn't need math-tests-exceptions.h and math-tests-rounding.h in the 
> nofpu directory because things will be handled automatically when 
> bits/fenv.h avoids defining unsupported things.
> 
> If they are the same ABI, I don't see any use for the CSKY_HARD_FLOAT 
> macro defined in preconfigure; nothing seems to test it, so it's only 
> relevant if shlib-versions is testing it (i.e. if they are different ABIs 
> with different dynamic linker names).

Hard float will use to vr to pass arguments, the ABI is imcompatible if the
function has any float-point arguments. I use the same dynamic linker names
because there is no float in ldso, the same ldso can be used on system with
soft float/hard float. Seems I still need to use different dynamic linker
names even if they are compatible, and distinct soft float/hard float in
bits/fenv.h to make glibc have correct definitions?
> 
> Does C-SKY hard float support exception traps or not?  math-tests-trap.h 
> has a comment saying not.  But you have an implementation of 
> feenableexcept that implies it does support exception traps.
> 
> * If exception traps are never supported, everything related to them 
> (including the definition of FE_NOMASK_ENV) should be removed; the default 
> feenableexcept and fedisableexcept and fegetexcept implementations should 
> suffice.
> 
> * If exception traps are always supported, your math-tests-trap.h is wrong 
> and should be removed.
> 
> * If they are conditionally supported, like on Arm and AArch64, your 
> math-tests-trap.h is appropriate with a different comment explaining the 
> conditional support - but various fenv.h functions like feenableexcept 
> need to check for the support and give errors if asked to enable 
> exception traps they are unable to enable (this includes fesetenv and 
> feupdateenv passed FE_NOMASK_ENV - see Arm and AArch64 for examples).
>

Exception traps is design to be conditionally supported, seems define to no
for compatibility. All the cpu with fpu have exception traps support at
present and I have no method to check whether hardware support that, so I
prefer to remove math-tests-trap.h.

> > Several patches will be post to GCC and Binutils to fix some testcase fail
> > later this month, while the follow results have these patches applied.
> 
> Note that glibc ports can't go in while they depend on such non-upstream 
> patches for good results (see the ARC port discussion).  You can send a 
> list of all the patches required to get the given test results, but 
> they'll need to be upstream (as will the Linux kernel port) before the 
> port can go into glibc.
>

I can understand the glibc patch and test-result should base on upstreamed
gcc/binutils/linux. The purpose for this submission is to make sure there
is no big issue in this patchset itself. Once other components are ready
I can test the patch again and resubmit it easily.
I'v got another issue while using build-many-glibcs.py. 
csky-linux-gnuabiv2-gcc can not recognise -profile during the make check
stage and stoped. but it can recognise --profile. Is this a problem will
block the c-sky glibc port goes in.
 
> > 5. The following cases fail due to gcc optimize change the sequence of
> >    -a * b to -(a * b) and got 1ulps error.
> >    math/test-double-tgamma
> >    math/test-float-tgamma
> >    math/test-float32-tgamma
> >    math/test-float32x-tgamma
> >    math/test-float64-tgamma
> >    math/test-ldouble-tgamma
> 
> So that needs a GCC bug fix (just like when the Arm and AArch64 ports of 
> GCC used to have such a bug).
>

We have this bug tracked internally. Also need to report a bug on gcc bugzilla? 

Thanks,
Han Mao
Joseph Myers Sept. 13, 2018, 12:36 p.m. UTC | #3
On Thu, 13 Sep 2018, Mao Han wrote:

> Hard float will use to vr to pass arguments, the ABI is imcompatible if the
> function has any float-point arguments. I use the same dynamic linker names
> because there is no float in ldso, the same ldso can be used on system with
> soft float/hard float. Seems I still need to use different dynamic linker
> names even if they are compatible, and distinct soft float/hard float in
> bits/fenv.h to make glibc have correct definitions?

A different dynamic linker name should be used because the ABI to libc and 
other glibc libraries is incompatible; if you have a different dynamic 
linker name for every ABI, that allows distributions using Debian-style 
multiarch directory arrangements to have libraries for both ABIs installed 
simultaneously.  Then, because you can't sensibly use soft-float binaries 
with hard-float libm, you should have the conditionals in bits/fenv.h (a 
single installed header should be set up to work for both ABIs) so that it 
doesn't define macros for unsupported features for soft float.

Once you have the conditionals in bits/fenv.h, the glibc testsuite will 
automatically disable tests for unsupported features for soft float, and 
internal calls to fenv.h functions within libm will automatically be 
optimized out for soft float.

It's not required, but it's a good idea to make binutils check for ABI 
incompatibilities at static link time, using GNU object attributes, which 
GCC should generate based on the ABI selected when compiling.  See how 
powerpc and mips handle this, for example.  That helps protect against 
user mistakes (linking .o files for different ABIs together) by making the 
linker complain about such mixing.

The Argument Passing section of the ABI document you provided doesn't seem 
to say anything about the different argument passing for hard float, so I 
think you need to update the document to cover that issue (likewise for 
return values if they are handled differently for hard float).  (And the 
table in 2.2.1.2 would presumably also need to say what's used for 
argument passing.)

> Exception traps is design to be conditionally supported, seems define to no
> for compatibility. All the cpu with fpu have exception traps support at
> present and I have no method to check whether hardware support that, so I
> prefer to remove math-tests-trap.h.

Yes, removing math-tests-trap.h until you are able to test on a platform 
without exception traps support seems reasonable.

On Arm / AArch64, the processor specification is that the trap-enable bits 
in the control register always read as 0 if the processor does not support 
exception traps.  Thus, the glibc implementations of relevant fenv.h 
functions read back the control register after writing it to see if the 
bits were set successfully.  If C-SKY follows a similar specification, 
that would provide a way for the fenv.h functions to test whether traps 
were enabled as requested and return an error if not.

> I'v got another issue while using build-many-glibcs.py. 
> csky-linux-gnuabiv2-gcc can not recognise -profile during the make check
> stage and stoped. but it can recognise --profile. Is this a problem will
> block the c-sky glibc port goes in.

We want the build-many-glibcs.py build to succeed.  You'll need to 
investigate why you see this problem.  The -profile option is defined in 
gcc/config/gnu-user.opt which all *-linux* targets should be using, so 
you'll need to look at why you get an error there.

> > > 5. The following cases fail due to gcc optimize change the sequence of
> > >    -a * b to -(a * b) and got 1ulps error.
> > >    math/test-double-tgamma
> > >    math/test-float-tgamma
> > >    math/test-float32-tgamma
> > >    math/test-float32x-tgamma
> > >    math/test-float64-tgamma
> > >    math/test-ldouble-tgamma
> > 
> > So that needs a GCC bug fix (just like when the Arm and AArch64 ports of 
> > GCC used to have such a bug).
> 
> We have this bug tracked internally. Also need to report a bug on gcc 
> bugzilla?

No, you just need to get a fix for the problem checked in upstream; no 
need to file a bug in GCC Bugzilla.
=?UTF-8?B?5q+b5pmX?= Sept. 18, 2018, 6:22 a.m. UTC | #4
On Thu, Sep 13, 2018 at 12:36:15PM +0000, Joseph Myers wrote:
> A different dynamic linker name should be used because the ABI to libc and 
> other glibc libraries is incompatible; if you have a different dynamic 
> linker name for every ABI, that allows distributions using Debian-style 
> multiarch directory arrangements to have libraries for both ABIs installed 
> simultaneously.  Then, because you can't sensibly use soft-float binaries 
> with hard-float libm, you should have the conditionals in bits/fenv.h (a 
> single installed header should be set up to work for both ABIs) so that it 
> doesn't define macros for unsupported features for soft float.
> 
> Once you have the conditionals in bits/fenv.h, the glibc testsuite will 
> automatically disable tests for unsupported features for soft float, and 
> internal calls to fenv.h functions within libm will automatically be 
> optimized out for soft float.
>

OK. I've add different dynamic linker name name for hard-float and put
some conditionals in bits/fenv.h, seems work fine.
 
> It's not required, but it's a good idea to make binutils check for ABI 
> incompatibilities at static link time, using GNU object attributes, which 
> GCC should generate based on the ABI selected when compiling.  See how 
> powerpc and mips handle this, for example.  That helps protect against 
> user mistakes (linking .o files for different ABIs together) by making the 
> linker complain about such mixing.

OK. I'll try to add some check here.

> The Argument Passing section of the ABI document you provided doesn't seem 
> to say anything about the different argument passing for hard float, so I 
> think you need to update the document to cover that issue (likewise for 
> return values if they are handled differently for hard float).  (And the 
> table in 2.2.1.2 would presumably also need to say what's used for 
> argument passing.)

OK. We will update it.

> We want the build-many-glibcs.py build to succeed.  You'll need to 
> investigate why you see this problem.  The -profile option is defined in 
> gcc/config/gnu-user.opt which all *-linux* targets should be using, so 
> you'll need to look at why you get an error there.
>
> > > > 5. The following cases fail due to gcc optimize change the sequence of
> > > >    -a * b to -(a * b) and got 1ulps error.
> > > >    math/test-double-tgamma
> > > >    math/test-float-tgamma
> > > >    math/test-float32-tgamma
> > > >    math/test-float32x-tgamma
> > > >    math/test-float64-tgamma
> > > >    math/test-ldouble-tgamma
> 
> No, you just need to get a fix for the problem checked in upstream; no 
> need to file a bug in GCC Bugzilla.

OK. My colleague Xianmiao Qu is working on these problems, will be fixed soon.

Thanks,
Han Mao
=?UTF-8?B?5q+b5pmX?= Sept. 18, 2018, 7:17 a.m. UTC | #5
On Tue, Sep 18, 2018 at 02:22:11PM +0800, Mao Han wrote:
> > It's not required, but it's a good idea to make binutils check for ABI 
> > incompatibilities at static link time, using GNU object attributes, which 
> > GCC should generate based on the ABI selected when compiling.  See how 
> > powerpc and mips handle this, for example.  That helps protect against 
> > user mistakes (linking .o files for different ABIs together) by making the 
> > linker complain about such mixing.
> 
> OK. I'll try to add some check here.
>

Seems I just missunderstand to add some check in glibc configure.
We have ABI check using eflag in elf header, which can recognize different
ISA but not float ABI.
We may support ABI check using GNU object attributes in the later version.

Thanks,
Han Mao
Joseph Myers Sept. 18, 2018, 11:43 a.m. UTC | #6
On Tue, 18 Sep 2018, Mao Han wrote:

> On Tue, Sep 18, 2018 at 02:22:11PM +0800, Mao Han wrote:
> > > It's not required, but it's a good idea to make binutils check for ABI 
> > > incompatibilities at static link time, using GNU object attributes, which 
> > > GCC should generate based on the ABI selected when compiling.  See how 
> > > powerpc and mips handle this, for example.  That helps protect against 
> > > user mistakes (linking .o files for different ABIs together) by making the 
> > > linker complain about such mixing.
> > 
> > OK. I'll try to add some check here.
> >
> 
> Seems I just missunderstand to add some check in glibc configure.
> We have ABI check using eflag in elf header, which can recognize different
> ISA but not float ABI.
> We may support ABI check using GNU object attributes in the later version.

Object attributes are generally appropriate for the static linker (ld); 
checks of the ELF header are generally appropriate for the dynamic linker 
(ld.so).