[RFC,v3,00/12] port C-SKY to glibc

Message ID cover.1530246556.git.han_mao@c-sky.com
State New
Headers show

Commit Message

Mao Han June 29, 2018, 7:58 a.m.
It is the third RFC patchset for C-SKY port. Base on commit 
1c09524e4db3efd797ebcfcd8241bdb78f0b06f0 (6 Jun). Three abi combinations
are supported with this patch: C-SKY ABIV2 with (soft float & little endian,
hard float & little endian, soft float & big 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/binutil/linux upstream are still on going, so there maight be a quite
long time before glibc ready to get in. This patchset can not used for
real build as the arch_minimum_kernel set to 4.1x and the dynamic linker names
, EM_ number are different with the one in gcc. This patchset base
on gcc(6.3), binutil(2.27), linux(4.16), which have not updated to the latest
version yet. They can be found in our private git repository:

1. GCC git repo path:
https://github.com/c-sky/gcc
2. Binutils git repo path:
https://github.com/c-sky/binutils-gdb
3. Linux git repo path
https://github.com/c-sky/csky-linux

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

The patchset is cross-tested on qemu system mode as some 
testscase(like sort-test) needquite large memory space, and I have not
got any board with ram larger than 1GB.
 
FAIL: elf/check-textrel
FAIL: elf/tst-prelink-cmp
FAIL: gmon/tst-gmon-gprof
FAIL: gmon/tst-gmon-pie-gprof
FAIL: gmon/tst-gmon-static-gprof
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
FAIL: misc/tst-clone3
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: posix/tst-glob_lstat_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
ummary of test results:
     10 FAIL
   4958 PASS
     27 UNSUPPORTED
     18 XFAIL

Detail result:
https://github.com/c-sky/test-result/blob/master/glibc/glibc_2.28_patch_v3_807_test_result.tar.gz

FAIL cases:
1. The following three cases will include f3 in the result:
   gmon/tst-gmon-gprof
   gmon/tst-gmon-pie-gprof
   gmon/tst-gmon-static-gprof
   I can not understand why f3 should not present here, and could not find root
   casue of it. 
FAIL

2. elf/tst-prelink-cmp
   symbol stdout is expect to be conflict here. I can not understand this
   case too.

3. 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

4. nptl/tst-thread_local1
   seems lack c++ thread local support, have not found root casue of it.

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

5. elf/check-textrel
   It fails because linker mark the symbol reference in eh-frame as textrel.
   Wait for our binutil to fix it.

6. 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.

7. nptl/tst-_res1
   It fails because symbol _res static linked in the same file.
   Wait for our binutil to fix it.

Hard float will cause a lot of testcases fail as our fpu can not caculate
denormal values. The hardware will flush input denormal values to zero or
the smallest float number before caculation when the denormal exception
is not enable. Our QEMU does the similar thing like the hardware. I don't
know is that ok to just make QEMU can deal with denormal caculation, or I 
need denormal exception handling in linux kernel like arm does.

The test for big endian have not done yet, and will be added in
the next patch.

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

 ChangeLog                                          |  144 ++
 NEWS                                               |    3 +
 README                                             |    1 +
 elf/elf.h                                          |   67 +-
 scripts/build-many-glibcs.py                       |    7 +
 sysdeps/csky/Implies                               |    4 +
 sysdeps/csky/Makefile                              |   13 +
 sysdeps/csky/abiv2/__longjmp.S                     |   61 +
 sysdeps/csky/abiv2/csky-mcount.S                   |   62 +
 sysdeps/csky/abiv2/dl-trampoline.S                 |   48 +
 sysdeps/csky/abiv2/memcpy.S                        |  205 ++
 sysdeps/csky/abiv2/setjmp.S                        |   77 +
 sysdeps/csky/abiv2/start.S                         |  115 ++
 sysdeps/csky/abiv2/strcmp.S                        |  187 ++
 sysdeps/csky/abiv2/strcpy.S                        |  138 ++
 sysdeps/csky/abiv2/tls-macros.h                    |   55 +
 sysdeps/csky/abort-instr.h                         |    2 +
 sysdeps/csky/atomic-machine.h                      |   97 +
 sysdeps/csky/bits/endian.h                         |   10 +
 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/crti.S                                |   96 +
 sysdeps/csky/crtn.S                                |   50 +
 sysdeps/csky/dl-machine.h                          |  364 ++++
 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                    |  284 +++
 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/fpu_control.h                     |  133 ++
 sysdeps/csky/fpu/fraiseexcpt.c                     |  126 ++
 sysdeps/csky/fpu/fsetexcptflg.c                    |   43 +
 sysdeps/csky/fpu/ftestexcept.c                     |   30 +
 sysdeps/csky/fpu/math_private.h                    |    7 +
 sysdeps/csky/gccframe.h                            |   21 +
 sysdeps/csky/jmpbuf-unwind.h                       |   48 +
 sysdeps/csky/ldsodefs.h                            |   42 +
 sysdeps/csky/libc-tls.c                            |   32 +
 sysdeps/csky/libm-test-ulps                        | 1694 ++++++++++++++++
 sysdeps/csky/libm-test-ulps-name                   |    1 +
 sysdeps/csky/linkmap.h                             |    4 +
 sysdeps/csky/machine-gmon.h                        |   32 +
 sysdeps/csky/math-tests.h                          |   32 +
 sysdeps/csky/memusage.h                            |   21 +
 sysdeps/csky/nofpu/Implies                         |    1 +
 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                          |   37 +
 sysdeps/csky/sfp-machine.h                         |   50 +
 sysdeps/csky/sotruss-lib.c                         |   49 +
 sysdeps/csky/stackinfo.h                           |   29 +
 sysdeps/csky/sysdep.h                              |   45 +
 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         |   88 +
 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       |   61 +
 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            |  103 +
 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            |   34 +
 .../unix/sysv/linux/csky/libBrokenLocale.abilist   |    1 +
 sysdeps/unix/sysv/linux/csky/libanl.abilist        |    4 +
 sysdeps/unix/sysv/linux/csky/libc.abilist          | 2079 ++++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/libcrypt.abilist      |    7 +
 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    |  216 ++
 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         |   78 +
 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       |  183 ++
 sysdeps/unix/sysv/linux/csky/shlib-versions        |    9 +
 sysdeps/unix/sysv/linux/csky/sigcontextinfo.h      |   38 +
 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        |   97 +
 sysdeps/unix/sysv/linux/csky/sys/user.h            |   65 +
 sysdeps/unix/sysv/linux/csky/syscalls.list         |    2 +
 sysdeps/unix/sysv/linux/csky/sysdep.h              |  596 ++++++
 124 files changed, 11366 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/csky-mcount.S
 create mode 100644 sysdeps/csky/abiv2/dl-trampoline.S
 create mode 100644 sysdeps/csky/abiv2/memcpy.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/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/crti.S
 create mode 100644 sysdeps/csky/crtn.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/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/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/math_private.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/math-tests.h
 create mode 100644 sysdeps/csky/memusage.h
 create mode 100644 sysdeps/csky/nofpu/Implies
 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/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

Patch

--- expected
+++ actual
@@ -1,3 +1,4 @@ 
 f1 2000
 f2 1000
+f3 1
 main 1