public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC PATCH V2 04/10] C-SKY: Hard Float Support
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (6 preceding siblings ...)
  2018-04-08  7:03 ` [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 02/10] C-SKY: TLS support Mao Han
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

This patch contains hardware floating-point support for C-SKY.

        * sysdeps/csky/fpu/fclrexcpt.c: New file
        * sysdeps/csky/fpu/fedisblxcpt.c: New file
        * sysdeps/csky/fpu/feenablxcpt.c: New file
        * sysdeps/csky/fpu/fegetenv.c: New file
        * sysdeps/csky/fpu/fegetexcept.c: New file
        * sysdeps/csky/fpu/fegetmode.c: New file
        * sysdeps/csky/fpu/fegetround.c: New file
        * sysdeps/csky/fpu/feholdexcpt.c: New file
        * sysdeps/csky/fpu/fenv_libc.h: New file
        * sysdeps/csky/fpu/fesetenv.c: New file
        * sysdeps/csky/fpu/fesetexcept.c: New file
        * sysdeps/csky/fpu/fesetmode.c: New file
        * sysdeps/csky/fpu/fesetround.c: New file
        * sysdeps/csky/fpu/feupdateenv.c: New file
        * sysdeps/csky/fpu/fgetexcptflg.c: New file
        * sysdeps/csky/fpu/fraiseexcpt.c: New file
        * sysdeps/csky/fpu/fsetexcptflg.c: New file
        * sysdeps/csky/fpu/ftestexcept.c: New file
        * sysdeps/csky/fpu_control.h: New file
---
 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 ++++++++++++++++++++++++++++++++++++++++
 19 files changed, 984 insertions(+)
 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

diff --git a/sysdeps/csky/fpu/fclrexcpt.c b/sysdeps/csky/fpu/fclrexcpt.c
new file mode 100644
index 0000000..3599e49
--- /dev/null
+++ b/sysdeps/csky/fpu/fclrexcpt.c
@@ -0,0 +1,47 @@
+/* Clear given exceptions in current floating-point environment.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fenv_libc.h>
+#include <fpu_control.h>
+
+int
+feclearexcept (int excepts)
+{
+#ifdef __csky_hard_float__
+  int fpsr;
+
+  /* Mask out unsupported bits/exceptions.  */
+  excepts &= FE_ALL_EXCEPT;
+
+  /* Read the complete control word.  */
+  _FPU_GETFPSR (fpsr);
+
+  /* Clear the relevant bits.  */
+  fpsr &= ~(excepts | (excepts << CAUSE_SHIFT));
+
+  /* Put the new data in effect.  */
+  _FPU_SETFPSR (fpsr);
+
+  return 0;
+#else
+  /* Unsupported, so fail unless nothing needs to be done.  */
+  return (excepts != 0);
+#endif /* __csky_hard_float__ */
+}
+libm_hidden_def (feclearexcept)
diff --git a/sysdeps/csky/fpu/fedisblxcpt.c b/sysdeps/csky/fpu/fedisblxcpt.c
new file mode 100644
index 0000000..6a70c0e
--- /dev/null
+++ b/sysdeps/csky/fpu/fedisblxcpt.c
@@ -0,0 +1,46 @@
+/* Disable floating-point exceptions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fenv_libc.h>
+#include <fpu_control.h>
+
+int
+fedisableexcept (int excepts)
+{
+#ifdef __csky_hard_float__
+  unsigned int new_exc, old_exc;
+
+  /* Get the current control word.  */
+  _FPU_GETCW (new_exc);
+
+  old_exc = (new_exc & ENABLE_MASK) >> ENABLE_SHIFT;
+
+  /* Get the except disable mask.  */
+  excepts &= FE_ALL_EXCEPT;
+  new_exc &= ~(excepts << ENABLE_SHIFT);
+
+  /* Put the new data in effect.  */
+  _FPU_SETCW (new_exc);
+
+  return old_exc;
+#else
+  /* Unsupported, so return -1 for failure.  */
+  return -1;
+#endif /* __csky_hard_float__ */
+}
diff --git a/sysdeps/csky/fpu/feenablxcpt.c b/sysdeps/csky/fpu/feenablxcpt.c
new file mode 100644
index 0000000..21c1e77
--- /dev/null
+++ b/sysdeps/csky/fpu/feenablxcpt.c
@@ -0,0 +1,45 @@
+/* Enable floating-point exceptions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fenv_libc.h>
+#include <fpu_control.h>
+
+int
+feenableexcept (int excepts)
+{
+#ifdef __csky_hard_float__
+  unsigned int new_exc, old_exc;
+
+  /* Get the current control word.  */
+  _FPU_GETCW (new_exc);
+
+  old_exc = (new_exc & ENABLE_MASK) >> ENABLE_SHIFT;
+
+  excepts &= FE_ALL_EXCEPT;
+
+  new_exc |= excepts << ENABLE_SHIFT;
+
+  _FPU_SETCW (new_exc);
+
+  return old_exc;
+#else
+  /* Unsupported, so return -1 for failure.  */
+  return -1;
+#endif /* __csky_hard_float__ */
+}
diff --git a/sysdeps/csky/fpu/fegetenv.c b/sysdeps/csky/fpu/fegetenv.c
new file mode 100644
index 0000000..19c3a74
--- /dev/null
+++ b/sysdeps/csky/fpu/fegetenv.c
@@ -0,0 +1,42 @@
+/* Store current floating-point environment.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+__fegetenv (fenv_t *envp)
+{
+#ifdef __csky_hard_float__
+  unsigned int fpcr;
+  unsigned int fpsr;
+
+  _FPU_GETCW (fpcr);
+  _FPU_GETFPSR (fpsr);
+  envp->__fpcr = fpcr;
+  envp->__fpsr = fpsr;
+
+  return 0;
+#else
+  /* Unsupported, so return 1 for failure.  */
+  return 1;
+#endif /* __csky_hard_float__ */
+}
+libm_hidden_def (__fegetenv)
+weak_alias (__fegetenv, fegetenv)
+libm_hidden_weak (fegetenv)
diff --git a/sysdeps/csky/fpu/fegetexcept.c b/sysdeps/csky/fpu/fegetexcept.c
new file mode 100644
index 0000000..784f4f7
--- /dev/null
+++ b/sysdeps/csky/fpu/fegetexcept.c
@@ -0,0 +1,37 @@
+/* Get enabled floating-point exceptions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fenv_libc.h>
+#include <fpu_control.h>
+
+int
+fegetexcept (void)
+{
+#ifdef __csky_hard_float__
+  unsigned int exc;
+
+  /* Get the current control word.  */
+  _FPU_GETCW (exc);
+
+  return (exc & ENABLE_MASK) >> ENABLE_SHIFT;
+#else
+  /* Unsupported. Return all exceptions disabled.  */
+  return 0;
+#endif /* __csky_hard_float__ */
+}
diff --git a/sysdeps/csky/fpu/fegetmode.c b/sysdeps/csky/fpu/fegetmode.c
new file mode 100644
index 0000000..f3115b1
--- /dev/null
+++ b/sysdeps/csky/fpu/fegetmode.c
@@ -0,0 +1,29 @@
+/* Store current floating-point control modes.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fegetmode (femode_t *modep)
+{
+#ifdef __csky_hard_float__
+  _FPU_GETCW (*modep);
+#endif /* __csky_hard_float__ */
+  return 0;
+}
diff --git a/sysdeps/csky/fpu/fegetround.c b/sysdeps/csky/fpu/fegetround.c
new file mode 100644
index 0000000..6e0fcec
--- /dev/null
+++ b/sysdeps/csky/fpu/fegetround.c
@@ -0,0 +1,39 @@
+/* Return current rounding direction.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+__fegetround (void)
+{
+#ifdef __csky_hard_float__
+  unsigned int cw;
+
+  /* Get control word.  */
+  _FPU_GETCW (cw);
+
+  return cw & FE_ROUND_MASK;
+#else
+  /* The current soft-float implementation only handles TONEAREST.  */
+  return FE_TONEAREST;
+#endif /* __csky_hard_float__ */
+}
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/csky/fpu/feholdexcpt.c b/sysdeps/csky/fpu/feholdexcpt.c
new file mode 100644
index 0000000..6c466d0
--- /dev/null
+++ b/sysdeps/csky/fpu/feholdexcpt.c
@@ -0,0 +1,39 @@
+/* Store current floating-point environment and clear exceptions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <fenv_libc.h>
+#include <fenv_private.h>
+
+#include <stdio.h>
+
+int
+__feholdexcept (fenv_t *envp)
+{
+#ifdef __csky_hard_float__
+  libc_feholdexcept_vfp (envp);
+  return 0;
+#else
+  /* Unsupported, so fail.  */
+  return 1;
+#endif /* __csky_hard_float__ */
+}
+libm_hidden_def (__feholdexcept)
+weak_alias (__feholdexcept, feholdexcept)
+libm_hidden_weak (feholdexcept)
diff --git a/sysdeps/csky/fpu/fenv_libc.h b/sysdeps/csky/fpu/fenv_libc.h
new file mode 100644
index 0000000..2dacb2c
--- /dev/null
+++ b/sysdeps/csky/fpu/fenv_libc.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _FENV_LIBC_H
+#define _FENV_LIBC_H	1
+
+/* Mask for enabling exceptions and for the CAUSE bits.  */
+#define ENABLE_MASK	0x0003FU
+#define CAUSE_MASK	0x3F000U
+
+/* Shift for FE_* flags to get up to the ENABLE bits and the CAUSE bits.  */
+#define	ENABLE_SHIFT	0
+#define CAUSE_SHIFT	8
+
+#endif /* _FENV_LIBC_H */
diff --git a/sysdeps/csky/fpu/fesetenv.c b/sysdeps/csky/fpu/fesetenv.c
new file mode 100644
index 0000000..0ac50a7
--- /dev/null
+++ b/sysdeps/csky/fpu/fesetenv.c
@@ -0,0 +1,64 @@
+/* Install given floating-point environment.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+__fesetenv (const fenv_t *envp)
+{
+#ifdef __csky_hard_float__
+  unsigned int fpcr;
+  unsigned int fpsr;
+
+  _FPU_GETCW (fpcr);
+  _FPU_GETFPSR (fpsr);
+
+  fpcr &= _FPU_RESERVED;
+  fpsr &= _FPU_FPSR_RESERVED;
+
+  if (envp == FE_DFL_ENV)
+    {
+      fpcr |= _FPU_DEFAULT;
+      fpsr |= _FPU_FPSR_DEFAULT;
+    }
+  else if (envp == FE_NOMASK_ENV)
+    {
+      fpcr |= _FPU_FPCR_IEEE;
+      fpsr |= _FPU_FPSR_IEEE;
+    }
+  else
+    {
+      fpcr |= envp->__fpcr & ~_FPU_RESERVED;
+      fpsr |= envp->__fpsr & ~_FPU_FPSR_RESERVED;
+    }
+
+  _FPU_SETFPSR (fpsr);
+
+  _FPU_SETCW (fpcr);
+
+  /* Success.  */
+  return 0;
+#else
+  /* Unsupported, so fail.  */
+  return 1;
+#endif /* __csky_hard_float__ */
+}
+libm_hidden_def (__fesetenv)
+weak_alias (__fesetenv, fesetenv)
+libm_hidden_weak (fesetenv)
diff --git a/sysdeps/csky/fpu/fesetexcept.c b/sysdeps/csky/fpu/fesetexcept.c
new file mode 100644
index 0000000..e0a90f6
--- /dev/null
+++ b/sysdeps/csky/fpu/fesetexcept.c
@@ -0,0 +1,37 @@
+/* Set given exception flags.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <fenv_libc.h>
+
+int
+fesetexcept (int excepts)
+{
+#ifdef __csky_hard_float__
+  fpu_control_t fpsr, new_fpsr;
+  _FPU_GETFPSR (fpsr);
+  new_fpsr = fpsr | ((excepts & FE_ALL_EXCEPT) << CAUSE_SHIFT);
+  if (new_fpsr != fpsr)
+    _FPU_SETFPSR (new_fpsr);
+#else
+  return (excepts != 0);
+#endif /* __csky_hard_float__ */
+
+  return 0;
+}
diff --git a/sysdeps/csky/fpu/fesetmode.c b/sysdeps/csky/fpu/fesetmode.c
new file mode 100644
index 0000000..9e259d0
--- /dev/null
+++ b/sysdeps/csky/fpu/fesetmode.c
@@ -0,0 +1,37 @@
+/* Install given floating-point control modes.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fesetmode (const femode_t *modep)
+{
+#ifdef __csky_hard_float__
+  if (modep == FE_DFL_MODE)
+    mode = _FPU_DEFAULT;
+  else
+    mode = *modep;
+  _FPU_SETCW (mode);
+
+  return 0;
+#else
+  /* Nothing to do.  */
+  return 0;
+#endif /* __csky_hard_float__ */
+}
diff --git a/sysdeps/csky/fpu/fesetround.c b/sysdeps/csky/fpu/fesetround.c
new file mode 100644
index 0000000..8aba20e
--- /dev/null
+++ b/sysdeps/csky/fpu/fesetround.c
@@ -0,0 +1,41 @@
+/* Set current rounding direction.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <fenv_private.h>
+
+#include <stdio.h>
+int
+__fesetround (int round)
+{
+#ifdef __csky_hard_float__
+  libc_fesetround_vfp (round);
+  return 0;
+#else
+  if (round == FE_TONEAREST)
+  /* This is the only supported rounding mode for soft-fp.  */
+    return 0;
+
+  /* Unsupported, so fail.  */
+  return 1;
+#endif /* __csky_hard_float__ */
+}
+libm_hidden_def (__fesetround)
+weak_alias (__fesetround, fesetround)
+libm_hidden_weak (fesetround)
diff --git a/sysdeps/csky/fpu/feupdateenv.c b/sysdeps/csky/fpu/feupdateenv.c
new file mode 100644
index 0000000..8972291
--- /dev/null
+++ b/sysdeps/csky/fpu/feupdateenv.c
@@ -0,0 +1,51 @@
+/* Install given floating-point environment and raise exceptions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <fenv_libc.h>
+#include <fenv_private.h>
+#include <stdio.h>
+
+int
+__feupdateenv (const fenv_t *envp)
+{
+#ifdef __csky_hard_float__
+  int temp;
+
+  /* Save current exceptions.  */
+  _FPU_GETFPSR(temp);
+  temp = (temp >> CAUSE_SHIFT) & FE_ALL_EXCEPT;
+  /* Install new environment.  */
+  libc_fesetenv_vfp (envp);
+
+  /* Raise the safed exception.  Incidently for us the implementation
+     defined format of the values in objects of type fexcept_t is the
+     same as the ones specified using the FE_* constants.  */
+  feraiseexcept (temp);
+
+  /* Success.  */
+  return 0;
+#else
+  /* Unsupported, so fail.  */
+  return 1;
+#endif /* __csky_hard_float__ */
+}
+libm_hidden_def (__feupdateenv)
+weak_alias (__feupdateenv, feupdateenv)
+libm_hidden_weak (feupdateenv)
diff --git a/sysdeps/csky/fpu/fgetexcptflg.c b/sysdeps/csky/fpu/fgetexcptflg.c
new file mode 100644
index 0000000..73d0ce8
--- /dev/null
+++ b/sysdeps/csky/fpu/fgetexcptflg.c
@@ -0,0 +1,37 @@
+/* Store current representation for exceptions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <fenv_libc.h>
+#include <fenv_private.h>
+#include <stdio.h>
+
+int
+fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+#ifdef __csky_hard_float__
+  *flagp = libc_fetestexcept_vfp (excepts);
+
+  /* Success.  */
+  return 0;
+#else
+  /* Unsupported, so fail.  */
+  return 1;
+#endif /* __csky_hard_float__ */
+}
diff --git a/sysdeps/csky/fpu/fraiseexcpt.c b/sysdeps/csky/fpu/fraiseexcpt.c
new file mode 100644
index 0000000..7456407
--- /dev/null
+++ b/sysdeps/csky/fpu/fraiseexcpt.c
@@ -0,0 +1,131 @@
+/* Raise given exceptions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fenv_libc.h>
+#include <fpu_control.h>
+#include <float.h>
+#include <math.h>
+
+int
+__feraiseexcept (int excepts)
+{
+#ifdef __csky_hard_float__
+    /* Raise exceptions represented by EXCEPTS.  But we must raise only one
+     signal at a time.  It is important that if the overflow/underflow
+     exception and the divide by zero exception are given at the same
+     time, the overflow/underflow exception follows the divide by zero
+     exception.  */
+
+# ifdef __csky_fpuv2__
+    /* First: invalid exception.  */
+    if (FE_INVALID & excepts)
+    {
+      /* One example of a invalid operation is 0 * Infinity.  */
+      float x = HUGE_VALF, y = 0.0f;
+      __asm__ __volatile__ ("fmuls %0, %0, %1" : "+v" (x) : "v" (y));
+    }
+
+    /* Next: division by zero.  */
+    if (FE_DIVBYZERO & excepts)
+    {
+      float x = 1.0f, y = 0.0f;
+      __asm__ __volatile__ ("fdivs %0, %0, %1" : "+v" (x) : "v" (y));
+    }
+
+    /* Next: overflow.  */
+    if (FE_OVERFLOW & excepts)
+    {
+      float x = FLT_MAX;
+      __asm__ __volatile__ ("fmuls %0, %0, %0" : "+v" (x));
+    }
+    /* Next: underflow.  */
+    if (FE_UNDERFLOW & excepts)
+    {
+      float x = -FLT_MIN;
+
+      __asm__ __volatile__ ("fmuls %0, %0, %0" : "+v" (x));
+    }
+
+    /* Last: inexact.  */
+    if (FE_INEXACT & excepts)
+    {
+      float x = 1.0f, y = 3.0f;
+      __asm__ __volatile__ ("fdivs %0, %0, %1" : "+v" (x) : "v" (y));
+    }
+
+    if (FE_DENORMAL & excepts)
+    {
+      double x = 4.9406564584124654e-324;
+      __asm__ __volatile__ ("fstod %0, %0" : "+v" (x));
+    }
+# else /* __csky_fpuv2__ */
+     int tmp = 0;
+    /* First: invalid exception.  */
+    if (FE_INVALID & excepts)
+    {
+      /* One example of a invalid operation is 0 * Infinity.  */
+      float x = HUGE_VALF, y = 0.0f;
+      __asm__ __volatile__ ("fmuls %0, %0, %2, %1"
+                    : "+f" (x), "+r"(tmp) : "f" (y));
+    }
+
+    /* Next: division by zero.  */
+    if (FE_DIVBYZERO & excepts)
+    {
+      float x = 1.0f, y = 0.0f;
+      __asm__ __volatile__ ("fdivs %0, %0, %2, %1"
+                    : "+f" (x), "+r"(tmp) : "f" (y));
+    }
+
+    /* Next: overflow.  */
+    if (FE_OVERFLOW & excepts)
+    {
+      float x = FLT_MAX, y = FLT_MAX;
+      __asm__ __volatile__ ("fmuls %0, %0, %2, %1"
+                    : "+f" (x), "+r"(tmp) : "f" (y));
+    }
+
+    /* Next: underflow.  */
+    if (FE_UNDERFLOW & excepts)
+    {
+      float x = -FLT_MIN, y = -FLT_MIN;
+
+      __asm__ __volatile__ ("fmuls %0, %0, %2, %1"
+                    : "+f" (x), "+r"(tmp) : "f" (y));
+    }
+
+    /* Last: inexact.  */
+    if (FE_INEXACT & excepts)
+    {
+      float x = 1.0f, y = 3.0f;
+      __asm__ __volatile__ ("fdivs %0, %0, %2, %1"
+                    : "+f" (x), "+r"(tmp) : "f" (y));
+    }
+# endif /* __csky_fpuv2__ */
+
+    /* Success.  */
+    return 0;
+#else /* __csky_hard_float__ */
+  /* Unsupported, so fail unless nothing needs to be done.  */
+  return (excepts != 0);
+#endif
+}
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
diff --git a/sysdeps/csky/fpu/fsetexcptflg.c b/sysdeps/csky/fpu/fsetexcptflg.c
new file mode 100644
index 0000000..79ddc50
--- /dev/null
+++ b/sysdeps/csky/fpu/fsetexcptflg.c
@@ -0,0 +1,48 @@
+/* Set floating-point environment exception handling.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <fenv_libc.h>
+
+int
+fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+#ifdef __csky_hard_float__
+  fpu_control_t temp;
+
+  /* Get the current exceptions.  */
+   _FPU_GETFPSR (temp);
+
+  /* Make sure the flags we want restored are legal.  */
+  excepts &= FE_ALL_EXCEPT;
+
+  /* Now clear the bits called for, and copy them in from flagp. Note that
+     we ignore all non-flag bits from *flagp, so they don't matter.  */
+  temp = ((temp >> CAUSE_SHIFT) & ~excepts) | (*flagp & excepts);
+  temp = temp << CAUSE_SHIFT;
+
+  _FPU_SETFPSR (temp);
+
+  /* Success.  */
+  return 0;
+#else
+  /* Unsupported, so fail unless nothing needs to be done.  */
+  return (excepts != 0);
+#endif
+}
diff --git a/sysdeps/csky/fpu/ftestexcept.c b/sysdeps/csky/fpu/ftestexcept.c
new file mode 100644
index 0000000..23f7f0b
--- /dev/null
+++ b/sysdeps/csky/fpu/ftestexcept.c
@@ -0,0 +1,35 @@
+/* Test exception in current environment.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <fenv_libc.h>
+#include <fenv_private.h>
+#include <stdio.h>
+
+int
+fetestexcept (int excepts)
+{
+#ifdef __csky_hard_float__
+  return libc_fetestexcept_vfp (excepts);
+#else
+  /* Unsupported, return 0.  */
+  return 0;
+#endif
+}
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/csky/fpu_control.h b/sysdeps/csky/fpu_control.h
new file mode 100644
index 0000000..2238bd1
--- /dev/null
+++ b/sysdeps/csky/fpu_control.h
@@ -0,0 +1,150 @@
+/* FPU control word bits. C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _FPU_CONTROL_H
+#define _FPU_CONTROL_H
+
+/*
+ * CSKY FPU floating point control register bits.
+ *
+ * 31-28  -> reserved (read as 0, write with 0)
+ * 27     -> 0: flush denormalized results to zero
+ *           1: flush denormalized results to signed minimal normal number.
+ * 26     -> reserved (read as 0, write with 0)
+ * 25-24  -> rounding control
+ * 23-6   -> reserved (read as 0, write with 0)
+ *  5     -> enable exception for input denormalized exception
+ *  4     -> enable exception for inexact exception
+ *  3     -> enable exception for underflow exception
+ *  2     -> enable exception for overflow exception
+ *  1     -> enable exception for division by zero exception
+ *  0     -> enable exception for invalid operation exception
+ *
+ * Rounding Control:
+ * 00 - rounding to nearest (RN)
+ * 01 - rounding toward zero (RZ)
+ * 10 - rounding (up) toward plus infinity (RP)
+ * 11 - rounding (down)toward minus infinity (RM)
+ *
+ * CSKY FPU floating point exception status register bits.
+ *
+ * 15     -> accumulate bit for any exception
+ * 14     -> reserved (read as 0, write with 0)
+ * 13     -> cause bit for input denormalized exception
+ * 12     -> cause bit for inexact exception
+ * 11     -> cause bit for underflow exception
+ * 10     -> cause bit for overflow exception
+ *  9     -> cause bit for division by zero exception
+ *  8     -> cause bit for invalid operation exception
+ *  7     -> flag bit for any exception
+ *  6     -> reserved (read as 0, write with 0)
+ *  5     -> flag exception for input denormalized exception
+ *  4     -> flag exception for inexact exception
+ *  3     -> flag exception for underflow exception
+ *  2     -> flag exception for overflow exception
+ *  1     -> flag exception for division by zero exception
+ *  0     -> flag exception for invalid operation exception
+ */
+
+#include <features.h>
+
+#ifdef __csky_soft_float__
+
+# define _FPU_RESERVED 0xffffffff
+# define _FPU_DEFAULT  0x00000000
+typedef unsigned int fpu_control_t;
+# define _FPU_GETCW(cw) (cw) = 0
+# define _FPU_SETCW(cw) (void) (cw)
+# define _FPU_GETFPSR(cw) (cw) = 0
+# define _FPU_SETFPSR(cw) (void) (cw)
+extern fpu_control_t __fpu_control;
+
+#else /* !__csky_soft_float__ */
+
+/* masking of interrupts */
+# define _FPU_MASK_IDE     (1 << 5)  /* input denormalized exception */
+# define _FPU_MASK_IXE     (1 << 4)  /* inexact exception            */
+# define _FPU_MASK_UFE     (1 << 3)  /* underflow exception          */
+# define _FPU_MASK_OFE     (1 << 2)  /* overflow exception           */
+# define _FPU_MASK_DZE     (1 << 1)  /* division by zero exception   */
+# define _FPU_MASK_IOE     (1 << 0)  /* invalid operation exception  */
+
+# define _FPU_MASK_FEA     (1 << 15) /* case for any exception */
+# define _FPU_MASK_FEC     (1 << 7)  /* flag for any exception */
+
+/* flush denormalized numbers to zero */
+# define _FPU_FLUSH_TZ   0x8000000
+
+/* rounding control */
+# define _FPU_RC_NEAREST (0x0 << 24)     /* RECOMMENDED */
+# define _FPU_RC_ZERO    (0x1 << 24)
+# define _FPU_RC_UP      (0x2 << 24)
+# define _FPU_RC_DOWN    (0x3 << 24)
+
+# define _FPU_RESERVED      0xf4ffffc0  /* Reserved bits in cw */
+# define _FPU_FPSR_RESERVED 0x3fff0000
+
+/* The fdlibm code requires strict IEEE double precision arithmetic,
+   and no interrupts for exceptions, rounding to nearest.  */
+
+# define _FPU_DEFAULT        0x00000000
+# define _FPU_FPSR_DEFAULT   0x00000000
+
+/* IEEE:  same as above, but exceptions */
+# define _FPU_FPCR_IEEE     0x0000001F
+# define _FPU_FPSR_IEEE     0x00000000
+
+/* Type of the control word.  */
+typedef unsigned int fpu_control_t;
+
+/* Macros for accessing the hardware control word.  */
+# if     (__CSKY__ == 2)
+#  define _FPU_GETCW(cw) __asm__ volatile ("mfcr %0, cr<1, 2>" : "=r" (cw))
+#  define _FPU_SETCW(cw) __asm__ volatile ("mtcr %0, cr<1, 2>" : : "r" (cw))
+#  define _FPU_GETFPSR(cw) __asm__ volatile ("mfcr %0, cr<2, 2>" : "=r" (cw))
+#  define _FPU_SETFPSR(cw) __asm__ volatile ("mtcr %0, cr<2, 2>" : : "r" (cw))
+# else  /* __CSKY__ != 2 */
+#  define _FPU_GETCW(cw) __asm__ volatile ("1: cprcr  %0, cpcr2 \n"         \
+                                         "   btsti  %0, 31    \n"           \
+                                         "   bt     1b        \n"           \
+		                                 "   cprcr  %0, cpcr1\n" : "=b" (cw))
+
+#  define _FPU_SETCW(cw) __asm__ volatile ("1: cprcr  r7, cpcr2 \n"         \
+                                         "   btsti  r7, 31    \n"           \
+                                         "   bt     1b        \n"           \
+                                         "   cpwcr  %0, cpcr1 \n"           \
+                                         : : "b" (cw) : "r7")
+
+#  define _FPU_GETFPSR(cw) __asm__ volatile ("1: cprcr  %0, cpcr2 \n"       \
+                                           "   btsti  %0, 31    \n"         \
+                                           "   bt     1b        \n"         \
+                                           "   cprcr  %0, cpcr4\n" : "=b" (cw))
+
+#  define _FPU_SETFPSR(cw) __asm__ volatile ("1: cprcr  r7, cpcr2 \n"       \
+                                           "   btsti  r7, 31    \n"         \
+                                           "   bt     1b        \n"         \
+                                           "   cpwcr %0, cpcr4  \n"         \
+                                           : : "b" (cw) : "r7")
+# endif /* __CSKY__ != 2 */
+
+/* Default control word set at startup.  */
+extern fpu_control_t __fpu_control;
+
+#endif /* !__csky_soft_float__ */
+
+#endif	/* fpu_control.h */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 09/10] C-SKY: Linux Startup and Dynamic Loading Code
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 07/10] C-SKY: ABI Lists Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 03/10] C-SKY: Generic math Routines Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 05/10] C-SKY: Atomic and Locking Routines Mao Han
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

This contains the Linux-specific code for loading programs on C-SKY.

        * elf/elf.h: Add C-SKY relocale
        * sysdeps/csky/dl-machine.h: New file
        * sysdeps/csky/dl-procinfo.c: New file
        * sysdeps/csky/dl-procinfo.h: New file
        * sysdeps/csky/dl-sysdep.h: New file
        * sysdeps/csky/dl-tlsdesc.h: New file
        * sysdeps/csky/ldsodefs.h: New file
        * sysdeps/csky/linkmap.h: New file
        * sysdeps/csky/sotruss-lib.c: New file
        * sysdeps/unix/sysv/linux/csky/ldconfig.h: New file
---
 elf/elf.h                               |  67 ++++-
 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-tlsdesc.h               |  61 +++++
 sysdeps/csky/ldsodefs.h                 |  42 +++
 sysdeps/csky/linkmap.h                  |   5 +
 sysdeps/csky/sotruss-lib.c              |  49 ++++
 sysdeps/unix/sysv/linux/csky/ldconfig.h |  24 ++
 10 files changed, 863 insertions(+), 1 deletion(-)
 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-tlsdesc.h
 create mode 100644 sysdeps/csky/ldsodefs.h
 create mode 100644 sysdeps/csky/linkmap.h
 create mode 100644 sysdeps/csky/sotruss-lib.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/ldconfig.h

diff --git a/elf/elf.h b/elf/elf.h
index f774898..c8f20a0 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -360,8 +360,9 @@ typedef struct
 #define EM_RISCV	243	/* RISC-V */
 
 #define EM_BPF		247	/* Linux BPF -- in-kernel virtual machine */
+#define EM_CSKY         252     /* C_SKY */
 
-#define EM_NUM		248
+#define EM_NUM		253
 
 /* Old spellings/synonyms.  */
 
@@ -3013,6 +3014,70 @@ enum
 /* Keep this the last entry.  */
 #define R_ARM_NUM		256
 
+/* csky */
+#define R_CKCORE_NONE               0	/* no reloc */
+#define R_CKCORE_ADDR32             1	/* direct 32 bit (S + A) */
+#define R_CKCORE_PCRELIMM8BY4       2	/* disp ((S + A - P) >> 2) &0xff    */
+#define R_CKCORE_PCRELIMM11BY2      3	/* disp ((S + A - P) >> 1) & 0x7ff  */
+#define R_CKCORE_PCREL32            5	/* 32-bit rel (S + A – P)           */
+#define R_CKCORE_PCRELJSR_IMM11BY2  6	/* disp ((S + A - P) >>1) & 0x7ff   */
+#define R_CKCORE_RELATIVE           9	/* 32 bit adjust program base(B + A)*/
+#define R_CKCORE_COPY               10	/* 32 bit adjust by program base    */
+#define R_CKCORE_GLOB_DAT           11	/* off between got and sym (S)      */
+#define R_CKCORE_JUMP_SLOT          12	/* PLT entry (S) */
+#define R_CKCORE_GOTOFF             13	/* offset to GOT (S + A – GOT)      */
+#define R_CKCORE_GOTPC              14	/* PC offset to GOT (GOT + A - P)   */
+#define R_CKCORE_GOT32              15	/* 32 bit GOT entry (G) */
+#define R_CKCORE_PLT32              16	/* 32 bit PLT entry (G) */
+#define R_CKCORE_ADDRGOT            17	/* GOT entry in GLOB_DAT (GOT + G)  */
+#define R_CKCORE_ADDRPLT            18	/* PLT entry in GLOB_DAT (GOT + G)  */
+#define R_CKCORE_PCREL_IMM26BY2     19	/* ((S + A - P) >> 1) & 0x3ffffff   */
+#define R_CKCORE_PCREL_IMM16BY2     20	/* disp ((S + A - P) >> 1) & 0xffff */
+#define R_CKCORE_PCREL_IMM16BY4     21	/* disp ((S + A - P) >> 2) & 0xffff */
+#define R_CKCORE_PCREL_IMM10BY2     22	/* disp ((S + A - P) >> 1) & 0x3ff  */
+#define R_CKCORE_PCREL_IMM10BY4     23	/* disp ((S + A - P) >> 2) & 0x3ff  */
+#define R_CKCORE_ADDR_HI16          24	/* high&low 16 bit ADDR */
+                                        /* ((S + A) >> 16) & 0xffff */
+#define R_CKCORE_ADDR_LO16          25	/* (S + A) & 0xffff */
+#define R_CKCORE_GOTPC_HI16         26	/* high&low 16 bit GOTPC */
+                                        /* ((GOT + A - P) >> 16) & 0xffff */
+#define R_CKCORE_GOTPC_LO16         27	/* (GOT + A – P) & 0xffff */
+#define R_CKCORE_GOTOFF_HI16        28	/* high&low 16 bit GOTOFF */
+                                        /* ((S + A - GOT) >> 16) & 0xffff */
+#define R_CKCORE_GOTOFF_LO16        29	/* (S + A - GOT) & 0xffff */
+#define R_CKCORE_GOT12              30	/* 12 bit disp GOT entry (G) */
+#define R_CKCORE_GOT_HI16           31	/* high&low 16 bit GOT */
+                                        /* (G >> 16) & 0xffff */
+#define R_CKCORE_GOT_LO16           32	/* (G & 0xffff) */
+#define R_CKCORE_PLT12              33	/* 12 bit disp PLT entry (G) */
+#define R_CKCORE_PLT_HI16           34	/* high&low 16 bit PLT */
+                                        /* (G >> 16) & 0xffff */
+#define R_CKCORE_PLT_LO16           35	/* G & 0xffff */
+#define R_CKCORE_ADDRGOT_HI16       36	/* high&low 16 bit ADDRGOT */
+                                        /* (GOT + G * 4)& 0xffff */
+#define R_CKCORE_ADDRGOT_LO16       37	/* (GOT + G * 4) & 0xffff */
+#define R_CKCORE_ADDRPLT_HI16       38	/* high&low 16 bit ADDRPLT */
+                                        /* ((GOT + G * 4) >> 16) & 0xFFFF */
+#define R_CKCORE_ADDRPLT_LO16       39	/* (GOT+G*4) & 0xffff */
+#define R_CKCORE_PCREL_JSR_IMM26BY2 40	/* disp ((S+A-P) >>1) &x3ffffff */
+#define R_CKCORE_TOFFSET_LO16       41	/* (S+A-BTEXT) & 0xffff */
+#define R_CKCORE_DOFFSET_LO16       42	/* (S+A-BTEXT) & 0xffff */
+#define R_CKCORE_PCREL_IMM18BY2     43	/* disp ((S+A-P) >>1) &0x3ffff */
+#define R_CKCORE_DOFFSET_IMM18      44	/* disp (S+A-BDATA)&0x3ffff */
+#define R_CKCORE_DOFFSET_IMM18BY2   45	/* disp ((S+A-BDATA)>>1)&0x3ffff */
+#define R_CKCORE_DOFFSET_IMM18BY4   46	/* disp ((S+A-BDATA)>>2)&0x3ffff */
+#define R_CKCORE_GOT_IMM18BY4       48	/* disp (G >> 2) */
+#define R_CKCORE_PLT_IMM18BY4       49	/* disp (G >> 2) */
+#define R_CKCORE_PCREL_IMM7BY4      50	/* disp ((S+A-P) >>2) & 0x7f */
+#define R_CKCORE_TLS_LE32           51  /* 32 bit offset to TLS block */
+#define R_CKCORE_TLS_IE32           52
+#define R_CKCORE_TLS_GD32           53
+#define R_CKCORE_TLS_LDM32          54
+#define R_CKCORE_TLS_LDO32          55
+#define R_CKCORE_TLS_DTPMOD32       56
+#define R_CKCORE_TLS_DTPOFF32       57
+#define R_CKCORE_TLS_TPOFF32        58
+
 /* IA-64 specific declarations.  */
 
 /* Processor specific flags for the Ehdr e_flags field.  */
diff --git a/sysdeps/csky/dl-machine.h b/sysdeps/csky/dl-machine.h
new file mode 100644
index 0000000..b11b210
--- /dev/null
+++ b/sysdeps/csky/dl-machine.h
@@ -0,0 +1,471 @@
+/* Machine-dependent ELF dynamic relocation inline functions.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef dl_machine_h
+#define dl_machine_h
+
+#define ELF_MACHINE_NAME "csky"
+
+#include <sys/param.h>
+#include <sysdep.h>
+#include <dl-tls.h>
+
+/* Return nonzero iff ELF header is compatible with the running host.  */
+static inline int
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
+{
+#ifndef  __CSKYABIV2__
+  return ehdr->e_machine == EM_RCE;
+#else
+  return ehdr->e_machine == EM_CSKY;
+#endif
+}
+
+/* Return the link-time address of _DYNAMIC.
+   This must be inlined in a function which uses global data.  */
+static inline Elf32_Addr
+elf_machine_dynamic (void)
+{
+  register Elf32_Addr *got __asm__ ("gb");    /* need modify */
+  return *got;
+}
+
+/* Return the run-time load address ,of the shared object.  */
+static inline Elf32_Addr
+elf_machine_load_address (void)
+{
+#ifdef __CSKYABIV2__
+  extern Elf32_Addr __dl_start (void *) asm ("_dl_start");
+  Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
+  Elf32_Addr pcrel_addr;
+  asm  ("grs %0,_dl_start\n" : "=r" (pcrel_addr));
+#else
+  extern Elf32_Addr __start_flag (void *) asm ("start_flag");
+  Elf32_Addr got_addr = (Elf32_Addr) &__start_flag;
+  Elf32_Addr pcrel_addr;
+  asm  ("subi sp,8\n"		\
+	"stw lr,(sp,0)\n"	\
+	"bsr start_flag\n"	\
+	"start_flag:"		\
+	"mov  %0, lr\n"		\
+	"ldw lr,(sp,0)\n" 	\
+	"addi sp,8\n"		\
+	: "=r" (pcrel_addr));
+#endif
+  return pcrel_addr - got_addr;
+}
+
+
+/* Set up the loaded object described by L so its unrelocated PLT
+   entries will jump to the on-demand fixup code in dl-runtime.c.  */
+
+static inline int __attribute__ ((always_inline))
+elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+{
+  Elf32_Addr *got;
+  extern void _dl_runtime_resolve (Elf32_Word);
+  extern void _dl_runtime_profile (Elf32_Word);
+
+  if (l->l_info[DT_JMPREL] && lazy)
+    {
+      /* The GOT entries for functions in the PLT have not yet been
+	 filled in.  Their initial contents will arrange when called
+	 to push an offset into the .rela.plt section, push
+	 _GLOBAL_OFFSET_TABLE_[1], and then jump to
+	 _GLOBAL_OFFSET_TABLE_[2].  */
+      got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
+
+      if (got[1])
+	l->l_mach.plt = got[1] + l->l_addr;
+      got[1] = (Elf32_Addr) l;	/* Identify this shared object.  */
+
+      /* The got[2] entry contains the address of a function which gets
+	 called to get the address of a so far unresolved function and
+	 jump to it.  The profiling extension of the dynamic linker allows
+	 to intercept the calls to collect information.  In this case we
+	 don't store the address in the GOT so that all future calls also
+	 end in this function.  */
+	got[2] = (Elf32_Addr) &_dl_runtime_resolve;
+    }
+  return lazy;
+}
+
+/* Mask identifying addresses reserved for the user program,
+   where the dynamic linker should not map anything.  */
+#define ELF_MACHINE_USER_ADDRESS_MASK	0x80000000UL
+
+/* Initial entry point code for the dynamic linker.
+   The C function `_dl_start' is the real entry point;
+   its return value is the user program's entry point.  */
+#ifdef __CSKYABIV2__
+#define RTLD_START asm ("\
+.text\n\
+.globl _start\n\
+.type _start, @function\n\
+.globl _dl_start_user\n\
+.type _dl_start_user, @function\n\
+_start:\n\
+        grs	gb, .Lgetpc1\n\
+.Lgetpc1:\n\
+	lrw	t0, .Lgetpc1@GOTPC\n\
+        addu	gb, t0\n\
+        mov     a0, sp\n\
+        lrw     t1, _dl_start@GOTOFF\n\
+        addu    t1, gb\n\
+        jsr     t1\n\
+_dl_start_user:\n\
+        /* get _dl_skip_args */    \n\
+	lrw	r11, _dl_skip_args@GOTOFF\n\
+	addu    r11, gb\n\
+	ldw     r11, (r11, 0)\n\
+        /* store program entry address in r11 */ \n\
+        mov     r10, a0\n\
+        /* Get argc */\n\
+        ldw     a1, (sp, 0)\n\
+        /* Get **argv */\n\
+        mov     a2, sp\n\
+        addi    a2, 4\n\
+        cmpnei  r11, 0\n\
+        bt      .L_fixup_stack\n\
+.L_done_fixup:\n\
+        mov 	a3, a1\n\
+        lsli 	a3, 2\n\
+        add     a3, a2\n\
+        addi 	a3, 4\n\
+        lrw     a0, _rtld_local@GOTOFF\n\
+        addu 	a0, gb\n\
+        ldw     a0, (a0, 0)\n\
+        lrw     t1, _dl_init@PLT\n\
+        addu    t1, gb\n\
+        ldw	t1, (t1)\n\
+        jsr     t1\n\
+        lrw     a0, _dl_fini@GOTOFF\n\
+        addu 	a0, gb\n\
+        jmp 	r10\n\
+.L_fixup_stack:\n\
+        subu    a1, r11\n\
+        lsli    r11, 2\n\
+        addu    sp, r11\n\
+        stw     a1, (sp, 0)\n\
+        mov     a2, sp\n\
+        addi    a2, 4\n\
+        lrw     a3, _dl_argv@GOTOFF\n\
+        addu    a3, gb\n\
+        stw     a2, (a3, 0)\n\
+        br      .L_done_fixup\n\
+");
+#else
+#define RTLD_START asm ("\
+.text\n\
+.globl _start\n\
+.type _start, @function\n\
+.globl _dl_start_user\n\
+.type _dl_start_user, @function\n\
+_start:\n\
+        bsr     .Lgetpc1\n\
+.Lgetpc1:\n\
+        lrw     gb, .Lgetpc1@GOTPC\n\
+        addu    gb, lr\n\
+        mov     a0, sp\n\
+        lrw     r7, _dl_start@GOTOFF\n\
+        addu    r7, gb\n\
+        jsr     r7\n\
+_dl_start_user:\n\
+        /* get _dl_skip_args */    \n\
+        lrw     r8, _dl_skip_args@GOTOFF\n\
+        addu    r8, gb\n\
+        ldw     r8, (r8, 0)\n\
+        /* store program entry address in r11 */ \n\
+        mov     r11, a0\n\
+        /* Get argc */\n\
+        ldw     a1, (sp, 0)\n\
+        /* Get **argv */\n\
+        mov     a2, sp\n\
+        addi    a2, 4\n\
+        cmpnei  r8, 0\n\
+        bt      .L_fixup_stack\n\
+.L_done_fixup:\n\
+        mov     a3, a1\n\
+        lsli    a3, 2\n\
+        addu    a3, a2\n\
+        addi    a3, 4\n\
+        lrw     a0, _rtld_local@GOTOFF\n\
+        addu    a0, gb\n\
+        ldw     a0, (a0, 0)\n\
+        lrw     r7, _dl_init@PLT\n\
+        addu    r7, gb\n\
+        ldw     r7, (r7)\n\
+        jsr     r7\n\
+        lrw     a0, _dl_fini@GOTOFF\n\
+        addu    a0, gb\n\
+        jmp     r11\n\
+.L_fixup_stack:\n\
+        subu    a1, r8\n\
+        stw     a1, (sp, 0)\n\
+        mov     a3, a2\n\
+        lsli    r8, 2\n\
+        addu    r8, a2\n\
+1:      ldw     r10, (r8, 0)\n\
+        stw     r10, (a3, 0)\n\
+        addi    r8, 4\n\
+        addi    a3, 4\n\
+        cmpnei  r10, 0\n\
+        bt      1b\n\
+1:      ldw     r10, (r8, 0)\n\
+        stw     r10, (a3, 0)\n\
+        addi    r8, 4\n\
+        addi    a3, 4\n\
+        cmpnei  r10, 0\n\
+        bt      1b\n\
+        subi    r8, 4\n\
+1:      ldw     a0, (r8, 0)\n\
+        cmpnei  a0, 0\n\
+        ldw     r10,(r8, 4)\n\
+        stw     a0, (a3, 0)\n\
+        stw     r10, (a3, 4)\n\
+        addi    a3, 8\n\
+        addi    r8, 8\n\
+        ldw     a0, (r8, 0)\n\
+        ldw     r10,(r8, 4)\n\
+        stw     a0, (a3, 0)\n\
+        stw     r10, (a3, 4)\n\
+        addi    a3, 8\n\
+        addi    r8, 8\n\
+        ldw     a0, (r8, 0)\n\
+        ldw     r10,(r8, 4)\n\
+        stw     a0, (a3, 0)\n\
+        stw     r10, (a3, 4)\n\
+        addi    a3, 8\n\
+        addi    r8, 8\n\
+        bt      1b\n\
+        lrw     a3, _dl_argv@GOTOFF\n\
+        addu    a3, gb\n\
+        stw     a2, (a3, 0)\n\
+        br      .L_done_fixup\n\
+");
+#endif
+
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
+   TLS variable, so undefined references should not be allowed to
+   define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#ifndef RTLD_BOOTSTRAP
+# define elf_machine_type_class(type) \
+  ((((type) == R_CKCORE_JUMP_SLOT || (type) == R_CKCORE_TLS_DTPMOD32          \
+     || (type) == R_CKCORE_TLS_DTPOFF32 || (type) == R_CKCORE_TLS_TPOFF32)    \
+    * ELF_RTYPE_CLASS_PLT)                                              \
+   | (((type) == R_CKCORE_COPY) * ELF_RTYPE_CLASS_COPY))
+#else
+#define elf_machine_type_class(type) \
+  ((((type) == R_CKCORE_JUMP_SLOT	     \
+   | (((type) == R_CKCORE_COPY) * ELF_RTYPE_CLASS_COPY))
+#endif
+
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
+#define ELF_MACHINE_JMP_SLOT	R_CKCORE_JUMP_SLOT
+
+/* The csky never uses Elf32_Rel relocations.  */
+#define ELF_MACHINE_NO_REL 1
+#define ELF_MACHINE_NO_RELA 0
+
+/* We define an initialization functions.  This is called very early in
+   _dl_sysdep_start.  */
+#define DL_PLATFORM_INIT dl_platform_init ()
+
+static inline void __attribute__ ((unused))
+dl_platform_init (void)
+{
+  if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
+    /* Avoid an empty string which would disturb us.  */
+    GLRO(dl_platform) = NULL;
+}
+
+static inline Elf32_Addr
+elf_machine_fixup_plt (struct link_map *map, lookup_t t,
+                       const ElfW(Sym) *refsym, const ElfW(Sym) *sym,
+                       const Elf32_Rela *reloc,
+                       Elf32_Addr *reloc_addr, Elf32_Addr value)
+{
+  return *reloc_addr = value;
+}
+
+/* Return the final value of a plt relocation.  On the csky the JMP_SLOT
+   relocation ignores the addend.  */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+		       Elf32_Addr value)
+{
+  return value;
+}
+
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER csky_gnu_pltenter
+#define ARCH_LA_PLTEXIT csky_gnu_pltexit
+
+#endif /* !dl_machine_h */
+#ifdef RESOLVE_MAP
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+   MAP is the object containing the reloc.  */
+
+auto inline void __attribute__ ((unused, always_inline))
+elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
+		  const Elf32_Sym *sym, const struct r_found_version *version,
+		  void *const reloc_addr_arg, int skip_ifunc)
+{
+  Elf32_Addr *const reloc_addr = reloc_addr_arg;
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+  unsigned short __attribute__((unused)) *opcode16_addr;
+  Elf32_Addr __attribute__((unused)) insn_opcode = 0x0;
+
+  if (__builtin_expect (r_type == R_CKCORE_RELATIVE, 0))
+    *reloc_addr = map->l_addr + reloc->r_addend;
+  else
+    {
+      const Elf32_Sym *const refsym = sym;
+      struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
+      Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
+      opcode16_addr = (unsigned short *)reloc_addr;
+
+      switch (r_type)
+	{
+	case R_CKCORE_COPY:
+	  if (sym == NULL)
+	    /* This can happen in trace mode if an object could not be
+	       found.  */
+	    break;
+	  if (sym->st_size > refsym->st_size
+	      || (sym->st_size < refsym->st_size && GLRO(dl_verbose)))
+	    {
+	      const char *strtab;
+
+	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+	      _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+				rtld_progname ?: "<program name unknown>",
+				strtab + refsym->st_name);
+	    }
+	  memcpy (reloc_addr_arg, (void *) value,
+		  MIN (sym->st_size, refsym->st_size));
+	  break;
+	case R_CKCORE_GLOB_DAT:
+	case R_CKCORE_JUMP_SLOT:
+	  *reloc_addr = value;
+	  break;
+	case R_CKCORE_ADDR32:
+	  *reloc_addr = value + reloc->r_addend;
+	  break;
+	case R_CKCORE_PCREL32:
+	  *reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr;
+	  break;
+#if defined(__CK810__) || defined(__CK807__)
+    case R_CKCORE_ADDR_HI16:
+      insn_opcode = (*opcode16_addr << 16) | (*(opcode16_addr + 1));
+      insn_opcode = (insn_opcode & 0xffff0000)
+                        | (((value + reloc->r_addend) >> 16) & 0xffff);
+      *(opcode16_addr++) = (unsigned short)(insn_opcode >> 16);
+      *opcode16_addr = (unsigned short)(insn_opcode & 0xffff);
+      break;
+    case R_CKCORE_ADDR_LO16:
+      insn_opcode = (*opcode16_addr << 16) | (*(opcode16_addr + 1));
+      insn_opcode = (insn_opcode & 0xffff0000)
+                        | ((value + reloc->r_addend) & 0xffff);
+       *(opcode16_addr++) = (unsigned short)(insn_opcode >> 16);
+       *opcode16_addr = (unsigned short)(insn_opcode & 0xffff);
+       break;
+    case R_CKCORE_PCREL_IMM26BY2:
+    {
+      unsigned int offset = ((value + reloc->r_addend -
+                              (unsigned int)reloc_addr) >> 1);
+      insn_opcode = (*opcode16_addr << 16) | (*(opcode16_addr + 1));
+      if (offset > 0x3ffffff){
+        const char *strtab;
+        strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+
+        _dl_error_printf ("\
+%s:The reloc R_CKCORE_PCREL_IMM26BY2 cannot reach the symbol '%s'.\n",
+          rtld_progname ?: "<program name unknown>",
+          strtab + refsym->st_name);
+        break;
+      }
+      insn_opcode = (insn_opcode & ~0x3ffffff) | offset;
+      *(opcode16_addr++) = (unsigned short)(insn_opcode >> 16);
+      *opcode16_addr = (unsigned short)(insn_opcode & 0xffff);
+      break;
+    }
+    case R_CKCORE_PCREL_JSR_IMM26BY2:
+      break;
+#endif
+#ifndef RTLD_BOOTSTRAP
+	case R_CKCORE_TLS_DTPMOD32:
+        /* Get the information from the link map returned by the
+           resolv function.  */
+	  if (sym_map != NULL)
+	    *reloc_addr = sym_map->l_tls_modid;
+	  break;
+	case R_CKCORE_TLS_DTPOFF32:
+	  if (sym != NULL)
+	    *reloc_addr =(sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
+	  break;
+	case R_CKCORE_TLS_TPOFF32:
+	  if (sym != NULL)
+	    {
+	      CHECK_STATIC_TLS (map, sym_map);
+	      *reloc_addr = (sym->st_value + sym_map->l_tls_offset
+                             + reloc->r_addend);
+	    }
+	  break;
+#endif /* !RTLD_BOOTSTRAP */
+	case R_CKCORE_NONE:		/* Alright, Wilbur.  */
+	  break;
+	default:
+	  break;
+	}
+    }
+}
+
+auto inline void __attribute__ ((unused, always_inline))
+elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+			   void *const reloc_addr_arg)
+{
+  Elf32_Addr *const reloc_addr = reloc_addr_arg;
+  *reloc_addr = l_addr + reloc->r_addend;
+}
+
+auto inline void __attribute__ ((unused, always_inline))
+elf_machine_lazy_rel (struct link_map *map,
+		      Elf32_Addr l_addr, const Elf32_Rela *reloc,
+		      int skip_ifunc)
+{
+  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+  if (ELF32_R_TYPE (reloc->r_info) == R_CKCORE_JUMP_SLOT)
+  {
+  /* Check for unexpected PLT reloc type.  */
+    if (__builtin_expect (r_type == R_CKCORE_JUMP_SLOT, 1))
+      {
+        if (__builtin_expect (map->l_mach.plt, 0) == 0)
+          *reloc_addr = l_addr + reloc->r_addend;
+        else
+          *reloc_addr = map->l_mach.plt;
+      }
+  }
+}
+
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/csky/dl-procinfo.c b/sysdeps/csky/dl-procinfo.c
new file mode 100644
index 0000000..b0d0054
--- /dev/null
+++ b/sysdeps/csky/dl-procinfo.c
@@ -0,0 +1,62 @@
+/* Data for C-SKY version of processor capability information.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This information must be kept in sync with the _DL_PLATFORM_COUNT
+   definitions in procinfo.h.
+
+   If anything should be added here check whether the size of each string
+   is still ok with the given array size.
+
+   All the #ifdefs in the definitions are quite irritating but
+   necessary if we want to avoid duplicating the information.  There
+   are three different modes:
+
+   - PROCINFO_DECL is defined.  This means we are only interested in
+     declarations.
+
+   - PROCINFO_DECL is not defined:
+
+     + if SHARED is defined the file is included in an array
+       initializer.  The .element = { ... } syntax is needed.
+
+     + if SHARED is not defined a normal array initialization is
+       needed.
+  */
+
+#ifndef PROCINFO_CLASS
+#define PROCINFO_CLASS
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_csky_platforms
+#else
+PROCINFO_CLASS const char _dl_csky_platforms[4][6]
+#endif
+#ifndef PROCINFO_DECL
+= {
+    "ck610", "ck807", "ck810", "ck860"
+  }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#undef PROCINFO_DECL
+#undef PROCINFO_CLASS
diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
new file mode 100644
index 0000000..4e7abe7
--- /dev/null
+++ b/sysdeps/csky/dl-procinfo.h
@@ -0,0 +1,59 @@
+/* C-SKY version of processor capability information handling macros.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+#ifndef _DL_PROCINFO_H
+#define _DL_PROCINFO_H	1
+
+#include <ldsodefs.h>
+
+/* Mask to filter out platforms.  */
+#define _DL_HWCAP_PLATFORM    (-1ULL)
+
+#define _DL_PLATFORMS_COUNT   4
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_platform (const char *str)
+{
+  int i;
+
+  if (str != NULL)
+    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
+      {
+        if (strcmp (str, GLRO(dl_csky_platforms)[i]) == 0)
+          return i;
+      }
+  return -1;
+};
+
+/* We cannot provide a general printing function.  */
+#define _dl_procinfo(word, val) -1
+
+/* There are no hardware capabilities defined.  */
+#define _dl_hwcap_string(idx) ""
+
+/* By default there is no important hardware capability.  */
+#define HWCAP_IMPORTANT (0)
+
+/* We don't have any hardware capabilities.  */
+#define _DL_HWCAP_COUNT	0
+
+#define _dl_string_hwcap(str) (-1)
+
+#endif /* dl-procinfo.h */
diff --git a/sysdeps/csky/dl-sysdep.h b/sysdeps/csky/dl-sysdep.h
new file mode 100644
index 0000000..7b3ab87
--- /dev/null
+++ b/sysdeps/csky/dl-sysdep.h
@@ -0,0 +1,23 @@
+/* System-specific settings for dynamic linker code.  Alpha version.
+  Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include_next <dl-sysdep.h>
+
+/* _dl_argv cannot be attribute_relro, because _dl_start_user
+   might write into it after _dl_start returns.  */
+#define DL_ARGV_NOT_RELRO 1
diff --git a/sysdeps/csky/dl-tlsdesc.h b/sysdeps/csky/dl-tlsdesc.h
new file mode 100644
index 0000000..16b2bb0
--- /dev/null
+++ b/sysdeps/csky/dl-tlsdesc.h
@@ -0,0 +1,61 @@
+/* Thread-local storage descriptor handling in the ELF dynamic linker.
+   CSKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _CSKY_DL_TLSDESC_H
+#define _CSKY_DL_TLSDESC_H 1
+
+/* Type used to represent a TLS descriptor in the GOT.  */
+struct tlsdesc
+{
+  union
+    {
+      void *pointer;
+      long value;
+    } argument;
+  ptrdiff_t (*entry)(struct tlsdesc *);
+};
+
+typedef struct dl_tls_index
+{
+  unsigned long int ti_module;
+  unsigned long int ti_offset;
+} tls_index;
+
+/* Type used as the argument in a TLS descriptor for a symbol that
+   needs dynamic TLS offsets.  */
+struct tlsdesc_dynamic_arg
+{
+  tls_index tlsinfo;
+  size_t gen_count;
+};
+
+extern ptrdiff_t attribute_hidden
+  _dl_tlsdesc_return(struct tlsdesc *),
+  _dl_tlsdesc_undefweak(struct tlsdesc *),
+  _dl_tlsdesc_resolve_hold(struct tlsdesc *),
+  _dl_tlsdesc_lazy_resolver(struct tlsdesc *);
+
+# ifdef SHARED
+extern void *_dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset);
+
+extern ptrdiff_t attribute_hidden
+  _dl_tlsdesc_dynamic(struct tlsdesc *);
+# endif
+
+#endif
diff --git a/sysdeps/csky/ldsodefs.h b/sysdeps/csky/ldsodefs.h
new file mode 100644
index 0000000..b002808
--- /dev/null
+++ b/sysdeps/csky/ldsodefs.h
@@ -0,0 +1,42 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _CSKY_LDSODEFS_H
+#define _CSKY_LDSODEFS_H 1
+
+#include <elf.h>
+
+struct La_csky_regs;
+struct La_csky_retval;
+
+#define ARCH_PLTENTER_MEMBERS	\
+    Elf32_Addr (*csky_gnu_pltenter) (Elf32_Sym *, unsigned int,		      \
+					 uintptr_t *, uintptr_t *,	      \
+					 struct La_csky_regs *,		      \
+					 unsigned int *, const char *name,    \
+					 long int *framesizep);
+
+#define ARCH_PLTEXIT_MEMBERS	\
+    unsigned int (*csky_gnu_pltexit) (Elf32_Sym *, unsigned int,	       \
+					  uintptr_t *, uintptr_t *,	       \
+					  const struct La_csky_regs *,	       \
+					  struct La_csky_retval *,	       \
+					  const char *);
+
+#include_next <ldsodefs.h>
+#endif
diff --git a/sysdeps/csky/linkmap.h b/sysdeps/csky/linkmap.h
new file mode 100644
index 0000000..7c2b4a6
--- /dev/null
+++ b/sysdeps/csky/linkmap.h
@@ -0,0 +1,5 @@
+struct link_map_machine
+  {
+    Elf32_Addr plt; /* Address of .plt */
+    void *tlsdesc_table; /* Address of TLS descriptor hash table.  */
+  };
diff --git a/sysdeps/csky/sotruss-lib.c b/sysdeps/csky/sotruss-lib.c
new file mode 100644
index 0000000..dac947e
--- /dev/null
+++ b/sysdeps/csky/sotruss-lib.c
@@ -0,0 +1,49 @@
+/* Override generic sotruss-lib.c to define actual functions for CSKY.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define HAVE_ARCH_PLTENTER
+#define HAVE_ARCH_PLTEXIT
+
+#include <elf/sotruss-lib.c>
+
+ElfW(Addr)
+la_csky_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
+		      unsigned int ndx __attribute__ ((unused)),
+		      uintptr_t *refcook, uintptr_t *defcook,
+		      La_csky_regs *regs, unsigned int *flags,
+		      const char *symname, long int *framesizep)
+{
+  print_enter (refcook, defcook, symname,
+	       regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2],
+	       *flags);
+
+  /* No need to copy anything, we will not need the parameters in any case.  */
+  *framesizep = 0;
+
+  return sym->st_value;
+}
+
+unsigned int
+la_csky_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
+		     uintptr_t *defcook, const struct La_csky_regs *inregs,
+		     struct La_csky_retval *outregs, const char *symname)
+{
+  print_exit (refcook, defcook, symname, outregs->lrv_v0);
+
+  return 0;
+}
diff --git a/sysdeps/unix/sysv/linux/csky/ldconfig.h b/sysdeps/unix/sysv/linux/csky/ldconfig.h
new file mode 100644
index 0000000..912a868
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/ldconfig.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/generic/ldconfig.h>
+
+#define SYSDEP_KNOWN_INTERPRETER_NAMES \
+  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 },
+#define SYSDEP_KNOWN_LIBRARY_NAMES \
+  { "libc.so.6", FLAG_ELF_LIBC6 },	\
+  { "libm.so.6", FLAG_ELF_LIBC6 },
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 08/10] C-SKY: Build Infastructure
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (3 preceding siblings ...)
  2018-04-08  7:03 ` [RFC PATCH V2 05/10] C-SKY: Atomic and Locking Routines Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-08  7:41   ` Andreas Schwab
  2018-04-17 20:54   ` Joseph Myers
  2018-04-08  7:03 ` [RFC PATCH V2 01/10] C-SKY: ABI related code Mao Han
                   ` (6 subsequent siblings)
  11 siblings, 2 replies; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

This patch contains all the implile, makefile and configure needed in
C-SKY porting.

        * scripts/config.sub: Add C-SKY arch
        * sysdeps/csky/Implies: New file
        * sysdeps/csky/Makefile: New file
        * sysdeps/csky/configure: New file
        * sysdeps/csky/configure.ac: New file
        * sysdeps/csky/tst-audit.h: New file
        * sysdeps/csky/nptl/Makefile: New file
        * sysdeps/csky/preconfigure: New file
        * sysdeps/unix/sysv/linux/csky/configure: New file
        * sysdeps/unix/sysv/linux/csky/configure.ac: New file
        * sysdeps/unix/sysv/linux/csky/Implies: New file
        * sysdeps/unix/sysv/linux/csky/Makefile: New file
---
 scripts/config.sub                        |  4 ++--
 sysdeps/csky/Implies                      |  4 ++++
 sysdeps/csky/Makefile                     | 13 +++++++++++++
 sysdeps/csky/configure                    |  4 ++++
 sysdeps/csky/configure.ac                 |  4 ++++
 sysdeps/csky/nptl/Makefile                | 20 ++++++++++++++++++++
 sysdeps/csky/preconfigure                 |  4 ++++
 sysdeps/csky/tst-audit.h                  | 23 +++++++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/Implies      |  4 ++++
 sysdeps/unix/sysv/linux/csky/Makefile     | 26 ++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/configure    |  5 +++++
 sysdeps/unix/sysv/linux/csky/configure.ac |  6 ++++++
 12 files changed, 115 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/csky/Implies
 create mode 100644 sysdeps/csky/Makefile
 create mode 100644 sysdeps/csky/configure
 create mode 100644 sysdeps/csky/configure.ac
 create mode 100644 sysdeps/csky/nptl/Makefile
 create mode 100644 sysdeps/csky/preconfigure
 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/configure
 create mode 100644 sysdeps/unix/sysv/linux/csky/configure.ac

diff --git a/scripts/config.sub b/scripts/config.sub
index f2632cd..9550e57 100755
--- a/scripts/config.sub
+++ b/scripts/config.sub
@@ -254,7 +254,7 @@ case $basic_machine in
 	| ba \
 	| be32 | be64 \
 	| bfin \
-	| c4x | c8051 | clipper \
+	| c4x | c8051 | clipper | csky \
 	| d10v | d30v | dlx | dsp16xx \
 	| e2k | epiphany \
 	| fido | fr30 | frv | ft32 \
@@ -378,7 +378,7 @@ case $basic_machine in
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
-	| c8051-* | clipper-* | craynv-* | cydra-* \
+	| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| e2k-* | elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
diff --git a/sysdeps/csky/Implies b/sysdeps/csky/Implies
new file mode 100644
index 0000000..781a016
--- /dev/null
+++ b/sysdeps/csky/Implies
@@ -0,0 +1,4 @@
+wordsize-32
+# CSKY uses IEEE 754 floating point.
+ieee754/flt-32
+ieee754/dbl-64
diff --git a/sysdeps/csky/Makefile b/sysdeps/csky/Makefile
new file mode 100644
index 0000000..4fa84bc
--- /dev/null
+++ b/sysdeps/csky/Makefile
@@ -0,0 +1,13 @@
+ifeq ($(subdir),csu)
+gen-as-const-headers += tcb-offsets.sym
+endif
+
+ifeq ($(subdir),debug)
+CFLAGS-backtrace.c += -funwind-tables
+endif
+
+ASFLAGS-.os += $(pic-ccflag)
+
+ifeq ($(subdir),gmon)
+sysdep_routines += csky-mcount
+endif
diff --git a/sysdeps/csky/configure b/sysdeps/csky/configure
new file mode 100644
index 0000000..53f5f1b
--- /dev/null
+++ b/sysdeps/csky/configure
@@ -0,0 +1,4 @@
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/riscv/elf.
+
+$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
diff --git a/sysdeps/csky/configure.ac b/sysdeps/csky/configure.ac
new file mode 100644
index 0000000..34f62d4
--- /dev/null
+++ b/sysdeps/csky/configure.ac
@@ -0,0 +1,4 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/riscv/elf.
+
+AC_DEFINE(PI_STATIC_AND_HIDDEN)
diff --git a/sysdeps/csky/nptl/Makefile b/sysdeps/csky/nptl/Makefile
new file mode 100644
index 0000000..a80a979
--- /dev/null
+++ b/sysdeps/csky/nptl/Makefile
@@ -0,0 +1,20 @@
+# Copyright (C) 2018 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+ifeq ($(subdir),csu)
+gen-as-const-headers += tcb-offsets.sym
+endif
diff --git a/sysdeps/csky/preconfigure b/sysdeps/csky/preconfigure
new file mode 100644
index 0000000..d95f0ab
--- /dev/null
+++ b/sysdeps/csky/preconfigure
@@ -0,0 +1,4 @@
+case "$machine" in
+csky*)          base_machine=csky
+		machine=csky
+esac
diff --git a/sysdeps/csky/tst-audit.h b/sysdeps/csky/tst-audit.h
new file mode 100644
index 0000000..6c64625
--- /dev/null
+++ b/sysdeps/csky/tst-audit.h
@@ -0,0 +1,23 @@
+/* Definitions for testing PLT entry/exit auditing.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define pltenter la_csky_gnu_pltenter
+#define pltexit la_csky_gnu_pltexit
+#define La_regs La_csky_regs
+#define La_retval La_csky_retval
+#define int_retval lrv_reg[0]
diff --git a/sysdeps/unix/sysv/linux/csky/Implies b/sysdeps/unix/sysv/linux/csky/Implies
new file mode 100644
index 0000000..2b5c256
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/Implies
@@ -0,0 +1,4 @@
+unix/sysv/linux/csky
+unix/sysv/linux/generic/wordsize-32
+unix/sysv/linux/generic
+csky/nptl
diff --git a/sysdeps/unix/sysv/linux/csky/Makefile b/sysdeps/unix/sysv/linux/csky/Makefile
new file mode 100644
index 0000000..ebaf5ac
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/Makefile
@@ -0,0 +1,26 @@
+ifeq ($(subdir),csu)
+sysdep_routines += read_tp libc-read_tp
+static-only-routines += read_tp
+shared-only-routines += libc-read_tp
+endif
+
+ifeq ($(subdir),elf)
+sysdep-rtld-routines += read_tp
+endif
+
+ifeq ($(subdir),misc)
+sysdep_routines += cacheflush
+sysdep_headers += sys/cachectl.h
+endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
+
+ifeq ($(subdir), csky)
+sysdep_headers += csky_readtp.h
+endif
+
+ifeq ($(subdir), malloc)
+libmemusage-routines += read_tp
+endif
diff --git a/sysdeps/unix/sysv/linux/csky/configure b/sysdeps/unix/sysv/linux/csky/configure
new file mode 100644
index 0000000..a3a7b81
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/configure
@@ -0,0 +1,5 @@
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+
+arch_minimum_kernel=2.6.25
+libc_cv_gcc_unwind_find_fde=no
+ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/csky/configure.ac b/sysdeps/unix/sysv/linux/csky/configure.ac
new file mode 100644
index 0000000..41746f8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/configure.ac
@@ -0,0 +1,6 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/csky
+
+arch_minimum_kernel=2.6.25
+libc_cv_gcc_unwind_find_fde=no
+ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 00/10] port C-SKY to glibc
@ 2018-04-08  7:03 Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 07/10] C-SKY: ABI Lists Mao Han
                   ` (11 more replies)
  0 siblings, 12 replies; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

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

-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 07/10] C-SKY: ABI Lists
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-09 22:25   ` Rafal Luzynski
  2018-04-08  7:03 ` [RFC PATCH V2 03/10] C-SKY: Generic math Routines Mao Han
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

        * sysdeps/unix/sysv/linux/csky/libc.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libutil.abilist: New file
        * sysdeps/unix/sysv/linux/csky/ld.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libanl.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libdl.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libm.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libnsl.abilist: New file
        * sysdeps/unix/sysv/linux/csky/librt.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libBrokenLocale.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libcrypt.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libpthread.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libresolv.abilist: New file
        * sysdeps/unix/sysv/linux/csky/libthread_db.abilist: New file
---
 sysdeps/unix/sysv/linux/csky/ld.abilist            |   10 +
 .../unix/sysv/linux/csky/libBrokenLocale.abilist   |    2 +
 sysdeps/unix/sysv/linux/csky/libanl.abilist        |    5 +
 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 +
 13 files changed, 3358 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/csky/ld.abilist
 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

diff --git a/sysdeps/unix/sysv/linux/csky/ld.abilist b/sysdeps/unix/sysv/linux/csky/ld.abilist
new file mode 100644
index 0000000..eb8a78c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/ld.abilist
@@ -0,0 +1,10 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 __libc_stack_end D 0x4
+GLIBC_2.27 __stack_chk_guard D 0x4
+GLIBC_2.27 __tls_get_addr F
+GLIBC_2.27 _dl_mcount F
+GLIBC_2.27 _r_debug D 0x14
+GLIBC_2.27 calloc F
+GLIBC_2.27 free F
+GLIBC_2.27 malloc F
+GLIBC_2.27 realloc F
diff --git a/sysdeps/unix/sysv/linux/csky/libBrokenLocale.abilist b/sysdeps/unix/sysv/linux/csky/libBrokenLocale.abilist
new file mode 100644
index 0000000..78f0bef
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libBrokenLocale.abilist
@@ -0,0 +1,2 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 __ctype_get_mb_cur_max F
diff --git a/sysdeps/unix/sysv/linux/csky/libanl.abilist b/sysdeps/unix/sysv/linux/csky/libanl.abilist
new file mode 100644
index 0000000..dea8bd0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libanl.abilist
@@ -0,0 +1,5 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 gai_cancel F
+GLIBC_2.27 gai_error F
+GLIBC_2.27 gai_suspend F
+GLIBC_2.27 getaddrinfo_a F
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
new file mode 100644
index 0000000..cfc6718
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -0,0 +1,2084 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 _Exit F
+GLIBC_2.27 _IO_2_1_stderr_ D 0x98
+GLIBC_2.27 _IO_2_1_stdin_ D 0x98
+GLIBC_2.27 _IO_2_1_stdout_ D 0x98
+GLIBC_2.27 _IO_adjust_column F
+GLIBC_2.27 _IO_adjust_wcolumn F
+GLIBC_2.27 _IO_default_doallocate F
+GLIBC_2.27 _IO_default_finish F
+GLIBC_2.27 _IO_default_pbackfail F
+GLIBC_2.27 _IO_default_uflow F
+GLIBC_2.27 _IO_default_xsgetn F
+GLIBC_2.27 _IO_default_xsputn F
+GLIBC_2.27 _IO_do_write F
+GLIBC_2.27 _IO_doallocbuf F
+GLIBC_2.27 _IO_fclose F
+GLIBC_2.27 _IO_fdopen F
+GLIBC_2.27 _IO_feof F
+GLIBC_2.27 _IO_ferror F
+GLIBC_2.27 _IO_fflush F
+GLIBC_2.27 _IO_fgetpos F
+GLIBC_2.27 _IO_fgetpos64 F
+GLIBC_2.27 _IO_fgets F
+GLIBC_2.27 _IO_file_attach F
+GLIBC_2.27 _IO_file_close F
+GLIBC_2.27 _IO_file_close_it F
+GLIBC_2.27 _IO_file_doallocate F
+GLIBC_2.27 _IO_file_finish F
+GLIBC_2.27 _IO_file_fopen F
+GLIBC_2.27 _IO_file_init F
+GLIBC_2.27 _IO_file_jumps D 0x54
+GLIBC_2.27 _IO_file_open F
+GLIBC_2.27 _IO_file_overflow F
+GLIBC_2.27 _IO_file_read F
+GLIBC_2.27 _IO_file_seek F
+GLIBC_2.27 _IO_file_seekoff F
+GLIBC_2.27 _IO_file_setbuf F
+GLIBC_2.27 _IO_file_stat F
+GLIBC_2.27 _IO_file_sync F
+GLIBC_2.27 _IO_file_underflow F
+GLIBC_2.27 _IO_file_write F
+GLIBC_2.27 _IO_file_xsputn F
+GLIBC_2.27 _IO_flockfile F
+GLIBC_2.27 _IO_flush_all F
+GLIBC_2.27 _IO_flush_all_linebuffered F
+GLIBC_2.27 _IO_fopen F
+GLIBC_2.27 _IO_fprintf F
+GLIBC_2.27 _IO_fputs F
+GLIBC_2.27 _IO_fread F
+GLIBC_2.27 _IO_free_backup_area F
+GLIBC_2.27 _IO_free_wbackup_area F
+GLIBC_2.27 _IO_fsetpos F
+GLIBC_2.27 _IO_fsetpos64 F
+GLIBC_2.27 _IO_ftell F
+GLIBC_2.27 _IO_ftrylockfile F
+GLIBC_2.27 _IO_funlockfile F
+GLIBC_2.27 _IO_fwrite F
+GLIBC_2.27 _IO_getc F
+GLIBC_2.27 _IO_getline F
+GLIBC_2.27 _IO_getline_info F
+GLIBC_2.27 _IO_gets F
+GLIBC_2.27 _IO_init F
+GLIBC_2.27 _IO_init_marker F
+GLIBC_2.27 _IO_init_wmarker F
+GLIBC_2.27 _IO_iter_begin F
+GLIBC_2.27 _IO_iter_end F
+GLIBC_2.27 _IO_iter_file F
+GLIBC_2.27 _IO_iter_next F
+GLIBC_2.27 _IO_least_wmarker F
+GLIBC_2.27 _IO_link_in F
+GLIBC_2.27 _IO_list_all D 0x4
+GLIBC_2.27 _IO_list_lock F
+GLIBC_2.27 _IO_list_resetlock F
+GLIBC_2.27 _IO_list_unlock F
+GLIBC_2.27 _IO_marker_delta F
+GLIBC_2.27 _IO_marker_difference F
+GLIBC_2.27 _IO_padn F
+GLIBC_2.27 _IO_peekc_locked F
+GLIBC_2.27 _IO_popen F
+GLIBC_2.27 _IO_printf F
+GLIBC_2.27 _IO_proc_close F
+GLIBC_2.27 _IO_proc_open F
+GLIBC_2.27 _IO_putc F
+GLIBC_2.27 _IO_puts F
+GLIBC_2.27 _IO_remove_marker F
+GLIBC_2.27 _IO_seekmark F
+GLIBC_2.27 _IO_seekoff F
+GLIBC_2.27 _IO_seekpos F
+GLIBC_2.27 _IO_seekwmark F
+GLIBC_2.27 _IO_setb F
+GLIBC_2.27 _IO_setbuffer F
+GLIBC_2.27 _IO_setvbuf F
+GLIBC_2.27 _IO_sgetn F
+GLIBC_2.27 _IO_sprintf F
+GLIBC_2.27 _IO_sputbackc F
+GLIBC_2.27 _IO_sputbackwc F
+GLIBC_2.27 _IO_sscanf F
+GLIBC_2.27 _IO_str_init_readonly F
+GLIBC_2.27 _IO_str_init_static F
+GLIBC_2.27 _IO_str_overflow F
+GLIBC_2.27 _IO_str_pbackfail F
+GLIBC_2.27 _IO_str_seekoff F
+GLIBC_2.27 _IO_str_underflow F
+GLIBC_2.27 _IO_sungetc F
+GLIBC_2.27 _IO_sungetwc F
+GLIBC_2.27 _IO_switch_to_get_mode F
+GLIBC_2.27 _IO_switch_to_main_wget_area F
+GLIBC_2.27 _IO_switch_to_wbackup_area F
+GLIBC_2.27 _IO_switch_to_wget_mode F
+GLIBC_2.27 _IO_un_link F
+GLIBC_2.27 _IO_ungetc F
+GLIBC_2.27 _IO_unsave_markers F
+GLIBC_2.27 _IO_unsave_wmarkers F
+GLIBC_2.27 _IO_vfprintf F
+GLIBC_2.27 _IO_vfscanf F
+GLIBC_2.27 _IO_vsprintf F
+GLIBC_2.27 _IO_wdefault_doallocate F
+GLIBC_2.27 _IO_wdefault_finish F
+GLIBC_2.27 _IO_wdefault_pbackfail F
+GLIBC_2.27 _IO_wdefault_uflow F
+GLIBC_2.27 _IO_wdefault_xsgetn F
+GLIBC_2.27 _IO_wdefault_xsputn F
+GLIBC_2.27 _IO_wdo_write F
+GLIBC_2.27 _IO_wdoallocbuf F
+GLIBC_2.27 _IO_wfile_jumps D 0x54
+GLIBC_2.27 _IO_wfile_overflow F
+GLIBC_2.27 _IO_wfile_seekoff F
+GLIBC_2.27 _IO_wfile_sync F
+GLIBC_2.27 _IO_wfile_underflow F
+GLIBC_2.27 _IO_wfile_xsputn F
+GLIBC_2.27 _IO_wmarker_delta F
+GLIBC_2.27 _IO_wsetb F
+GLIBC_2.27 ___brk_addr D 0x4
+GLIBC_2.27 __adjtimex F
+GLIBC_2.27 __after_morecore_hook D 0x4
+GLIBC_2.27 __argz_count F
+GLIBC_2.27 __argz_next F
+GLIBC_2.27 __argz_stringify F
+GLIBC_2.27 __asprintf F
+GLIBC_2.27 __asprintf_chk F
+GLIBC_2.27 __assert F
+GLIBC_2.27 __assert_fail F
+GLIBC_2.27 __assert_perror_fail F
+GLIBC_2.27 __backtrace F
+GLIBC_2.27 __backtrace_symbols F
+GLIBC_2.27 __backtrace_symbols_fd F
+GLIBC_2.27 __bsd_getpgrp F
+GLIBC_2.27 __bzero F
+GLIBC_2.27 __check_rhosts_file D 0x4
+GLIBC_2.27 __chk_fail F
+GLIBC_2.27 __clone F
+GLIBC_2.27 __close F
+GLIBC_2.27 __cmsg_nxthdr F
+GLIBC_2.27 __confstr_chk F
+GLIBC_2.27 __connect F
+GLIBC_2.27 __ctype_b_loc F
+GLIBC_2.27 __ctype_get_mb_cur_max F
+GLIBC_2.27 __ctype_tolower_loc F
+GLIBC_2.27 __ctype_toupper_loc F
+GLIBC_2.27 __curbrk D 0x4
+GLIBC_2.27 __cxa_at_quick_exit F
+GLIBC_2.27 __cxa_atexit F
+GLIBC_2.27 __cxa_finalize F
+GLIBC_2.27 __cxa_thread_atexit_impl F
+GLIBC_2.27 __cyg_profile_func_enter F
+GLIBC_2.27 __cyg_profile_func_exit F
+GLIBC_2.27 __daylight D 0x4
+GLIBC_2.27 __dcgettext F
+GLIBC_2.27 __default_morecore F
+GLIBC_2.27 __dgettext F
+GLIBC_2.27 __dprintf_chk F
+GLIBC_2.27 __dup2 F
+GLIBC_2.27 __duplocale F
+GLIBC_2.27 __endmntent F
+GLIBC_2.27 __environ D 0x4
+GLIBC_2.27 __errno_location F
+GLIBC_2.27 __explicit_bzero_chk F
+GLIBC_2.27 __fbufsize F
+GLIBC_2.27 __fcntl F
+GLIBC_2.27 __fdelt_chk F
+GLIBC_2.27 __fdelt_warn F
+GLIBC_2.27 __ffs F
+GLIBC_2.27 __fgets_chk F
+GLIBC_2.27 __fgets_unlocked_chk F
+GLIBC_2.27 __fgetws_chk F
+GLIBC_2.27 __fgetws_unlocked_chk F
+GLIBC_2.27 __finite F
+GLIBC_2.27 __finitef F
+GLIBC_2.27 __flbf F
+GLIBC_2.27 __fork F
+GLIBC_2.27 __fpending F
+GLIBC_2.27 __fprintf_chk F
+GLIBC_2.27 __fpu_control D 0x4
+GLIBC_2.27 __fpurge F
+GLIBC_2.27 __fread_chk F
+GLIBC_2.27 __fread_unlocked_chk F
+GLIBC_2.27 __freadable F
+GLIBC_2.27 __freading F
+GLIBC_2.27 __free_hook D 0x4
+GLIBC_2.27 __freelocale F
+GLIBC_2.27 __fsetlocking F
+GLIBC_2.27 __fwprintf_chk F
+GLIBC_2.27 __fwritable F
+GLIBC_2.27 __fwriting F
+GLIBC_2.27 __fxstat F
+GLIBC_2.27 __fxstat64 F
+GLIBC_2.27 __fxstatat F
+GLIBC_2.27 __fxstatat64 F
+GLIBC_2.27 __getauxval F
+GLIBC_2.27 __getcwd_chk F
+GLIBC_2.27 __getdelim F
+GLIBC_2.27 __getdomainname_chk F
+GLIBC_2.27 __getgroups_chk F
+GLIBC_2.27 __gethostname_chk F
+GLIBC_2.27 __getlogin_r_chk F
+GLIBC_2.27 __getmntent_r F
+GLIBC_2.27 __getpagesize F
+GLIBC_2.27 __getpgid F
+GLIBC_2.27 __getpid F
+GLIBC_2.27 __gets_chk F
+GLIBC_2.27 __gettimeofday F
+GLIBC_2.27 __getwd_chk F
+GLIBC_2.27 __gmtime_r F
+GLIBC_2.27 __h_errno_location F
+GLIBC_2.27 __isalnum_l F
+GLIBC_2.27 __isalpha_l F
+GLIBC_2.27 __isascii_l F
+GLIBC_2.27 __isblank_l F
+GLIBC_2.27 __iscntrl_l F
+GLIBC_2.27 __isctype F
+GLIBC_2.27 __isdigit_l F
+GLIBC_2.27 __isgraph_l F
+GLIBC_2.27 __isinf F
+GLIBC_2.27 __isinff F
+GLIBC_2.27 __islower_l F
+GLIBC_2.27 __isnan F
+GLIBC_2.27 __isnanf F
+GLIBC_2.27 __isoc99_fscanf F
+GLIBC_2.27 __isoc99_fwscanf F
+GLIBC_2.27 __isoc99_scanf F
+GLIBC_2.27 __isoc99_sscanf F
+GLIBC_2.27 __isoc99_swscanf F
+GLIBC_2.27 __isoc99_vfscanf F
+GLIBC_2.27 __isoc99_vfwscanf F
+GLIBC_2.27 __isoc99_vscanf F
+GLIBC_2.27 __isoc99_vsscanf F
+GLIBC_2.27 __isoc99_vswscanf F
+GLIBC_2.27 __isoc99_vwscanf F
+GLIBC_2.27 __isoc99_wscanf F
+GLIBC_2.27 __isprint_l F
+GLIBC_2.27 __ispunct_l F
+GLIBC_2.27 __isspace_l F
+GLIBC_2.27 __isupper_l F
+GLIBC_2.27 __iswalnum_l F
+GLIBC_2.27 __iswalpha_l F
+GLIBC_2.27 __iswblank_l F
+GLIBC_2.27 __iswcntrl_l F
+GLIBC_2.27 __iswctype F
+GLIBC_2.27 __iswctype_l F
+GLIBC_2.27 __iswdigit_l F
+GLIBC_2.27 __iswgraph_l F
+GLIBC_2.27 __iswlower_l F
+GLIBC_2.27 __iswprint_l F
+GLIBC_2.27 __iswpunct_l F
+GLIBC_2.27 __iswspace_l F
+GLIBC_2.27 __iswupper_l F
+GLIBC_2.27 __iswxdigit_l F
+GLIBC_2.27 __isxdigit_l F
+GLIBC_2.27 __ivaliduser F
+GLIBC_2.27 __key_decryptsession_pk_LOCAL D 0x4
+GLIBC_2.27 __key_encryptsession_pk_LOCAL D 0x4
+GLIBC_2.27 __key_gendes_LOCAL D 0x4
+GLIBC_2.27 __libc_allocate_rtsig F
+GLIBC_2.27 __libc_calloc F
+GLIBC_2.27 __libc_current_sigrtmax F
+GLIBC_2.27 __libc_current_sigrtmin F
+GLIBC_2.27 __libc_free F
+GLIBC_2.27 __libc_freeres F
+GLIBC_2.27 __libc_init_first F
+GLIBC_2.27 __libc_mallinfo F
+GLIBC_2.27 __libc_malloc F
+GLIBC_2.27 __libc_mallopt F
+GLIBC_2.27 __libc_memalign F
+GLIBC_2.27 __libc_pvalloc F
+GLIBC_2.27 __libc_realloc F
+GLIBC_2.27 __libc_sa_len F
+GLIBC_2.27 __libc_start_main F
+GLIBC_2.27 __libc_valloc F
+GLIBC_2.27 __longjmp_chk F
+GLIBC_2.27 __lseek F
+GLIBC_2.27 __lxstat F
+GLIBC_2.27 __lxstat64 F
+GLIBC_2.27 __malloc_hook D 0x4
+GLIBC_2.27 __mbrlen F
+GLIBC_2.27 __mbrtowc F
+GLIBC_2.27 __mbsnrtowcs_chk F
+GLIBC_2.27 __mbsrtowcs_chk F
+GLIBC_2.27 __mbstowcs_chk F
+GLIBC_2.27 __memalign_hook D 0x4
+GLIBC_2.27 __memcpy_chk F
+GLIBC_2.27 __memmove_chk F
+GLIBC_2.27 __mempcpy F
+GLIBC_2.27 __mempcpy_chk F
+GLIBC_2.27 __memset_chk F
+GLIBC_2.27 __monstartup F
+GLIBC_2.27 __morecore D 0x4
+GLIBC_2.27 __nanosleep F
+GLIBC_2.27 __newlocale F
+GLIBC_2.27 __nl_langinfo_l F
+GLIBC_2.27 __nss_configure_lookup F
+GLIBC_2.27 __nss_database_lookup F
+GLIBC_2.27 __nss_hostname_digits_dots F
+GLIBC_2.27 __nss_next F
+GLIBC_2.27 __obstack_printf_chk F
+GLIBC_2.27 __obstack_vprintf_chk F
+GLIBC_2.27 __open F
+GLIBC_2.27 __open64 F
+GLIBC_2.27 __open64_2 F
+GLIBC_2.27 __open_2 F
+GLIBC_2.27 __openat64_2 F
+GLIBC_2.27 __openat_2 F
+GLIBC_2.27 __overflow F
+GLIBC_2.27 __pipe F
+GLIBC_2.27 __poll F
+GLIBC_2.27 __poll_chk F
+GLIBC_2.27 __posix_getopt F
+GLIBC_2.27 __ppoll_chk F
+GLIBC_2.27 __pread64 F
+GLIBC_2.27 __pread64_chk F
+GLIBC_2.27 __pread_chk F
+GLIBC_2.27 __printf_chk F
+GLIBC_2.27 __printf_fp F
+GLIBC_2.27 __profile_frequency F
+GLIBC_2.27 __progname D 0x4
+GLIBC_2.27 __progname_full D 0x4
+GLIBC_2.27 __ptsname_r_chk F
+GLIBC_2.27 __pwrite64 F
+GLIBC_2.27 __rawmemchr F
+GLIBC_2.27 __rcmd_errstr D 0x4
+GLIBC_2.27 __read F
+GLIBC_2.27 __read_chk F
+GLIBC_2.27 __readlink_chk F
+GLIBC_2.27 __readlinkat_chk F
+GLIBC_2.27 __realloc_hook D 0x4
+GLIBC_2.27 __realpath_chk F
+GLIBC_2.27 __recv_chk F
+GLIBC_2.27 __recvfrom_chk F
+GLIBC_2.27 __register_atfork F
+GLIBC_2.27 __res_init F
+GLIBC_2.27 __res_nclose F
+GLIBC_2.27 __res_ninit F
+GLIBC_2.27 __res_randomid F
+GLIBC_2.27 __res_state F
+GLIBC_2.27 __rpc_thread_createerr F
+GLIBC_2.27 __rpc_thread_svc_fdset F
+GLIBC_2.27 __rpc_thread_svc_max_pollfd F
+GLIBC_2.27 __rpc_thread_svc_pollfd F
+GLIBC_2.27 __sbrk F
+GLIBC_2.27 __sched_cpualloc F
+GLIBC_2.27 __sched_cpucount F
+GLIBC_2.27 __sched_cpufree F
+GLIBC_2.27 __sched_get_priority_max F
+GLIBC_2.27 __sched_get_priority_min F
+GLIBC_2.27 __sched_getparam F
+GLIBC_2.27 __sched_getscheduler F
+GLIBC_2.27 __sched_setscheduler F
+GLIBC_2.27 __sched_yield F
+GLIBC_2.27 __select F
+GLIBC_2.27 __send F
+GLIBC_2.27 __setmntent F
+GLIBC_2.27 __setpgid F
+GLIBC_2.27 __sigaction F
+GLIBC_2.27 __signbit F
+GLIBC_2.27 __signbitf F
+GLIBC_2.27 __sigpause F
+GLIBC_2.27 __sigsetjmp F
+GLIBC_2.27 __sigsuspend F
+GLIBC_2.27 __snprintf_chk F
+GLIBC_2.27 __sprintf_chk F
+GLIBC_2.27 __stack_chk_fail F
+GLIBC_2.27 __statfs F
+GLIBC_2.27 __stpcpy F
+GLIBC_2.27 __stpcpy_chk F
+GLIBC_2.27 __stpncpy F
+GLIBC_2.27 __stpncpy_chk F
+GLIBC_2.27 __strcasecmp F
+GLIBC_2.27 __strcasecmp_l F
+GLIBC_2.27 __strcasestr F
+GLIBC_2.27 __strcat_chk F
+GLIBC_2.27 __strcoll_l F
+GLIBC_2.27 __strcpy_chk F
+GLIBC_2.27 __strdup F
+GLIBC_2.27 __strerror_r F
+GLIBC_2.27 __strfmon_l F
+GLIBC_2.27 __strftime_l F
+GLIBC_2.27 __strncasecmp_l F
+GLIBC_2.27 __strncat_chk F
+GLIBC_2.27 __strncpy_chk F
+GLIBC_2.27 __strndup F
+GLIBC_2.27 __strsep_g F
+GLIBC_2.27 __strtod_internal F
+GLIBC_2.27 __strtod_l F
+GLIBC_2.27 __strtof_internal F
+GLIBC_2.27 __strtof_l F
+GLIBC_2.27 __strtok_r F
+GLIBC_2.27 __strtol_internal F
+GLIBC_2.27 __strtol_l F
+GLIBC_2.27 __strtold_internal F
+GLIBC_2.27 __strtold_l F
+GLIBC_2.27 __strtoll_internal F
+GLIBC_2.27 __strtoll_l F
+GLIBC_2.27 __strtoul_internal F
+GLIBC_2.27 __strtoul_l F
+GLIBC_2.27 __strtoull_internal F
+GLIBC_2.27 __strtoull_l F
+GLIBC_2.27 __strverscmp F
+GLIBC_2.27 __strxfrm_l F
+GLIBC_2.27 __swprintf_chk F
+GLIBC_2.27 __sysconf F
+GLIBC_2.27 __syslog_chk F
+GLIBC_2.27 __sysv_signal F
+GLIBC_2.27 __timezone D 0x4
+GLIBC_2.27 __toascii_l F
+GLIBC_2.27 __tolower_l F
+GLIBC_2.27 __toupper_l F
+GLIBC_2.27 __towctrans F
+GLIBC_2.27 __towctrans_l F
+GLIBC_2.27 __towlower_l F
+GLIBC_2.27 __towupper_l F
+GLIBC_2.27 __ttyname_r_chk F
+GLIBC_2.27 __tzname D 0x8
+GLIBC_2.27 __uflow F
+GLIBC_2.27 __underflow F
+GLIBC_2.27 __uselocale F
+GLIBC_2.27 __vasprintf_chk F
+GLIBC_2.27 __vdprintf_chk F
+GLIBC_2.27 __vfork F
+GLIBC_2.27 __vfprintf_chk F
+GLIBC_2.27 __vfscanf F
+GLIBC_2.27 __vfwprintf_chk F
+GLIBC_2.27 __vprintf_chk F
+GLIBC_2.27 __vsnprintf F
+GLIBC_2.27 __vsnprintf_chk F
+GLIBC_2.27 __vsprintf_chk F
+GLIBC_2.27 __vsscanf F
+GLIBC_2.27 __vswprintf_chk F
+GLIBC_2.27 __vsyslog_chk F
+GLIBC_2.27 __vwprintf_chk F
+GLIBC_2.27 __wait F
+GLIBC_2.27 __waitpid F
+GLIBC_2.27 __wcpcpy_chk F
+GLIBC_2.27 __wcpncpy_chk F
+GLIBC_2.27 __wcrtomb_chk F
+GLIBC_2.27 __wcscasecmp_l F
+GLIBC_2.27 __wcscat_chk F
+GLIBC_2.27 __wcscoll_l F
+GLIBC_2.27 __wcscpy_chk F
+GLIBC_2.27 __wcsftime_l F
+GLIBC_2.27 __wcsncasecmp_l F
+GLIBC_2.27 __wcsncat_chk F
+GLIBC_2.27 __wcsncpy_chk F
+GLIBC_2.27 __wcsnrtombs_chk F
+GLIBC_2.27 __wcsrtombs_chk F
+GLIBC_2.27 __wcstod_internal F
+GLIBC_2.27 __wcstod_l F
+GLIBC_2.27 __wcstof_internal F
+GLIBC_2.27 __wcstof_l F
+GLIBC_2.27 __wcstol_internal F
+GLIBC_2.27 __wcstol_l F
+GLIBC_2.27 __wcstold_internal F
+GLIBC_2.27 __wcstold_l F
+GLIBC_2.27 __wcstoll_internal F
+GLIBC_2.27 __wcstoll_l F
+GLIBC_2.27 __wcstombs_chk F
+GLIBC_2.27 __wcstoul_internal F
+GLIBC_2.27 __wcstoul_l F
+GLIBC_2.27 __wcstoull_internal F
+GLIBC_2.27 __wcstoull_l F
+GLIBC_2.27 __wcsxfrm_l F
+GLIBC_2.27 __wctomb_chk F
+GLIBC_2.27 __wctrans_l F
+GLIBC_2.27 __wctype_l F
+GLIBC_2.27 __wmemcpy_chk F
+GLIBC_2.27 __wmemmove_chk F
+GLIBC_2.27 __wmempcpy_chk F
+GLIBC_2.27 __wmemset_chk F
+GLIBC_2.27 __woverflow F
+GLIBC_2.27 __wprintf_chk F
+GLIBC_2.27 __write F
+GLIBC_2.27 __wuflow F
+GLIBC_2.27 __wunderflow F
+GLIBC_2.27 __xmknod F
+GLIBC_2.27 __xmknodat F
+GLIBC_2.27 __xpg_basename F
+GLIBC_2.27 __xpg_sigpause F
+GLIBC_2.27 __xpg_strerror_r F
+GLIBC_2.27 __xstat F
+GLIBC_2.27 __xstat64 F
+GLIBC_2.27 _authenticate F
+GLIBC_2.27 _dl_mcount_wrapper F
+GLIBC_2.27 _dl_mcount_wrapper_check F
+GLIBC_2.27 _environ D 0x4
+GLIBC_2.27 _exit F
+GLIBC_2.27 _flushlbf F
+GLIBC_2.27 _libc_intl_domainname D 0x5
+GLIBC_2.27 _longjmp F
+GLIBC_2.27 _mcleanup F
+GLIBC_2.27 _mcount F
+GLIBC_2.27 _nl_default_dirname D 0x12
+GLIBC_2.27 _nl_domain_bindings D 0x4
+GLIBC_2.27 _nl_msg_cat_cntr D 0x4
+GLIBC_2.27 _null_auth D 0xc
+GLIBC_2.27 _obstack_allocated_p F
+GLIBC_2.27 _obstack_begin F
+GLIBC_2.27 _obstack_begin_1 F
+GLIBC_2.27 _obstack_free F
+GLIBC_2.27 _obstack_memory_used F
+GLIBC_2.27 _obstack_newchunk F
+GLIBC_2.27 _res D 0x200
+GLIBC_2.27 _res_hconf D 0x30
+GLIBC_2.27 _rpc_dtablesize F
+GLIBC_2.27 _seterr_reply F
+GLIBC_2.27 _setjmp F
+GLIBC_2.27 _sys_errlist D 0x218
+GLIBC_2.27 _sys_nerr D 0x4
+GLIBC_2.27 _sys_siglist D 0x104
+GLIBC_2.27 _tolower F
+GLIBC_2.27 _toupper F
+GLIBC_2.27 a64l F
+GLIBC_2.27 abort F
+GLIBC_2.27 abs F
+GLIBC_2.27 accept F
+GLIBC_2.27 accept4 F
+GLIBC_2.27 access F
+GLIBC_2.27 acct F
+GLIBC_2.27 addmntent F
+GLIBC_2.27 addseverity F
+GLIBC_2.27 adjtime F
+GLIBC_2.27 adjtimex F
+GLIBC_2.27 alarm F
+GLIBC_2.27 aligned_alloc F
+GLIBC_2.27 alphasort F
+GLIBC_2.27 alphasort64 F
+GLIBC_2.27 argp_err_exit_status D 0x4
+GLIBC_2.27 argp_error F
+GLIBC_2.27 argp_failure F
+GLIBC_2.27 argp_help F
+GLIBC_2.27 argp_parse F
+GLIBC_2.27 argp_program_bug_address D 0x4
+GLIBC_2.27 argp_program_version D 0x4
+GLIBC_2.27 argp_program_version_hook D 0x4
+GLIBC_2.27 argp_state_help F
+GLIBC_2.27 argp_usage F
+GLIBC_2.27 argz_add F
+GLIBC_2.27 argz_add_sep F
+GLIBC_2.27 argz_append F
+GLIBC_2.27 argz_count F
+GLIBC_2.27 argz_create F
+GLIBC_2.27 argz_create_sep F
+GLIBC_2.27 argz_delete F
+GLIBC_2.27 argz_extract F
+GLIBC_2.27 argz_insert F
+GLIBC_2.27 argz_next F
+GLIBC_2.27 argz_replace F
+GLIBC_2.27 argz_stringify F
+GLIBC_2.27 asctime F
+GLIBC_2.27 asctime_r F
+GLIBC_2.27 asprintf F
+GLIBC_2.27 atof F
+GLIBC_2.27 atoi F
+GLIBC_2.27 atol F
+GLIBC_2.27 atoll F
+GLIBC_2.27 authdes_create F
+GLIBC_2.27 authdes_getucred F
+GLIBC_2.27 authdes_pk_create F
+GLIBC_2.27 authnone_create F
+GLIBC_2.27 authunix_create F
+GLIBC_2.27 authunix_create_default F
+GLIBC_2.27 backtrace F
+GLIBC_2.27 backtrace_symbols F
+GLIBC_2.27 backtrace_symbols_fd F
+GLIBC_2.27 basename F
+GLIBC_2.27 bcmp F
+GLIBC_2.27 bcopy F
+GLIBC_2.27 bind F
+GLIBC_2.27 bind_textdomain_codeset F
+GLIBC_2.27 bindresvport F
+GLIBC_2.27 bindtextdomain F
+GLIBC_2.27 brk F
+GLIBC_2.27 bsd_signal F
+GLIBC_2.27 bsearch F
+GLIBC_2.27 btowc F
+GLIBC_2.27 bzero F
+GLIBC_2.27 c16rtomb F
+GLIBC_2.27 c32rtomb F
+GLIBC_2.27 cacheflush F
+GLIBC_2.27 calloc F
+GLIBC_2.27 callrpc F
+GLIBC_2.27 canonicalize_file_name F
+GLIBC_2.27 capget F
+GLIBC_2.27 capset F
+GLIBC_2.27 catclose F
+GLIBC_2.27 catgets F
+GLIBC_2.27 catopen F
+GLIBC_2.27 cbc_crypt F
+GLIBC_2.27 cfgetispeed F
+GLIBC_2.27 cfgetospeed F
+GLIBC_2.27 cfmakeraw F
+GLIBC_2.27 cfsetispeed F
+GLIBC_2.27 cfsetospeed F
+GLIBC_2.27 cfsetspeed F
+GLIBC_2.27 chdir F
+GLIBC_2.27 chflags F
+GLIBC_2.27 chmod F
+GLIBC_2.27 chown F
+GLIBC_2.27 chroot F
+GLIBC_2.27 clearenv F
+GLIBC_2.27 clearerr F
+GLIBC_2.27 clearerr_unlocked F
+GLIBC_2.27 clnt_broadcast F
+GLIBC_2.27 clnt_create F
+GLIBC_2.27 clnt_pcreateerror F
+GLIBC_2.27 clnt_perrno F
+GLIBC_2.27 clnt_perror F
+GLIBC_2.27 clnt_spcreateerror F
+GLIBC_2.27 clnt_sperrno F
+GLIBC_2.27 clnt_sperror F
+GLIBC_2.27 clntraw_create F
+GLIBC_2.27 clnttcp_create F
+GLIBC_2.27 clntudp_bufcreate F
+GLIBC_2.27 clntudp_create F
+GLIBC_2.27 clntunix_create F
+GLIBC_2.27 clock F
+GLIBC_2.27 clock_adjtime F
+GLIBC_2.27 clock_getcpuclockid F
+GLIBC_2.27 clock_getres F
+GLIBC_2.27 clock_gettime F
+GLIBC_2.27 clock_nanosleep F
+GLIBC_2.27 clock_settime F
+GLIBC_2.27 clone F
+GLIBC_2.27 close F
+GLIBC_2.27 closedir F
+GLIBC_2.27 closelog F
+GLIBC_2.27 confstr F
+GLIBC_2.27 connect F
+GLIBC_2.27 copy_file_range F
+GLIBC_2.27 copysign F
+GLIBC_2.27 copysignf F
+GLIBC_2.27 copysignl F
+GLIBC_2.27 creat F
+GLIBC_2.27 creat64 F
+GLIBC_2.27 ctermid F
+GLIBC_2.27 ctime F
+GLIBC_2.27 ctime_r F
+GLIBC_2.27 cuserid F
+GLIBC_2.27 daemon F
+GLIBC_2.27 daylight D 0x4
+GLIBC_2.27 dcgettext F
+GLIBC_2.27 dcngettext F
+GLIBC_2.27 delete_module F
+GLIBC_2.27 des_setparity F
+GLIBC_2.27 dgettext F
+GLIBC_2.27 difftime F
+GLIBC_2.27 dirfd F
+GLIBC_2.27 dirname F
+GLIBC_2.27 div F
+GLIBC_2.27 dl_iterate_phdr F
+GLIBC_2.27 dngettext F
+GLIBC_2.27 dprintf F
+GLIBC_2.27 drand48 F
+GLIBC_2.27 drand48_r F
+GLIBC_2.27 dup F
+GLIBC_2.27 dup2 F
+GLIBC_2.27 dup3 F
+GLIBC_2.27 duplocale F
+GLIBC_2.27 dysize F
+GLIBC_2.27 eaccess F
+GLIBC_2.27 ecb_crypt F
+GLIBC_2.27 ecvt F
+GLIBC_2.27 ecvt_r F
+GLIBC_2.27 endaliasent F
+GLIBC_2.27 endfsent F
+GLIBC_2.27 endgrent F
+GLIBC_2.27 endhostent F
+GLIBC_2.27 endmntent F
+GLIBC_2.27 endnetent F
+GLIBC_2.27 endnetgrent F
+GLIBC_2.27 endprotoent F
+GLIBC_2.27 endpwent F
+GLIBC_2.27 endrpcent F
+GLIBC_2.27 endservent F
+GLIBC_2.27 endsgent F
+GLIBC_2.27 endspent F
+GLIBC_2.27 endttyent F
+GLIBC_2.27 endusershell F
+GLIBC_2.27 endutent F
+GLIBC_2.27 endutxent F
+GLIBC_2.27 environ D 0x4
+GLIBC_2.27 envz_add F
+GLIBC_2.27 envz_entry F
+GLIBC_2.27 envz_get F
+GLIBC_2.27 envz_merge F
+GLIBC_2.27 envz_remove F
+GLIBC_2.27 envz_strip F
+GLIBC_2.27 epoll_create F
+GLIBC_2.27 epoll_create1 F
+GLIBC_2.27 epoll_ctl F
+GLIBC_2.27 epoll_pwait F
+GLIBC_2.27 epoll_wait F
+GLIBC_2.27 erand48 F
+GLIBC_2.27 erand48_r F
+GLIBC_2.27 err F
+GLIBC_2.27 error F
+GLIBC_2.27 error_at_line F
+GLIBC_2.27 error_message_count D 0x4
+GLIBC_2.27 error_one_per_line D 0x4
+GLIBC_2.27 error_print_progname D 0x4
+GLIBC_2.27 errx F
+GLIBC_2.27 ether_aton F
+GLIBC_2.27 ether_aton_r F
+GLIBC_2.27 ether_hostton F
+GLIBC_2.27 ether_line F
+GLIBC_2.27 ether_ntoa F
+GLIBC_2.27 ether_ntoa_r F
+GLIBC_2.27 ether_ntohost F
+GLIBC_2.27 euidaccess F
+GLIBC_2.27 eventfd F
+GLIBC_2.27 eventfd_read F
+GLIBC_2.27 eventfd_write F
+GLIBC_2.27 execl F
+GLIBC_2.27 execle F
+GLIBC_2.27 execlp F
+GLIBC_2.27 execv F
+GLIBC_2.27 execve F
+GLIBC_2.27 execvp F
+GLIBC_2.27 execvpe F
+GLIBC_2.27 exit F
+GLIBC_2.27 explicit_bzero F
+GLIBC_2.27 faccessat F
+GLIBC_2.27 fallocate F
+GLIBC_2.27 fallocate64 F
+GLIBC_2.27 fanotify_init F
+GLIBC_2.27 fanotify_mark F
+GLIBC_2.27 fattach F
+GLIBC_2.27 fchdir F
+GLIBC_2.27 fchflags F
+GLIBC_2.27 fchmod F
+GLIBC_2.27 fchmodat F
+GLIBC_2.27 fchown F
+GLIBC_2.27 fchownat F
+GLIBC_2.27 fclose F
+GLIBC_2.27 fcloseall F
+GLIBC_2.27 fcntl F
+GLIBC_2.27 fcvt F
+GLIBC_2.27 fcvt_r F
+GLIBC_2.27 fdatasync F
+GLIBC_2.27 fdetach F
+GLIBC_2.27 fdopen F
+GLIBC_2.27 fdopendir F
+GLIBC_2.27 feof F
+GLIBC_2.27 feof_unlocked F
+GLIBC_2.27 ferror F
+GLIBC_2.27 ferror_unlocked F
+GLIBC_2.27 fexecve F
+GLIBC_2.27 fflush F
+GLIBC_2.27 fflush_unlocked F
+GLIBC_2.27 ffs F
+GLIBC_2.27 ffsl F
+GLIBC_2.27 ffsll F
+GLIBC_2.27 fgetc F
+GLIBC_2.27 fgetc_unlocked F
+GLIBC_2.27 fgetgrent F
+GLIBC_2.27 fgetgrent_r F
+GLIBC_2.27 fgetpos F
+GLIBC_2.27 fgetpos64 F
+GLIBC_2.27 fgetpwent F
+GLIBC_2.27 fgetpwent_r F
+GLIBC_2.27 fgets F
+GLIBC_2.27 fgets_unlocked F
+GLIBC_2.27 fgetsgent F
+GLIBC_2.27 fgetsgent_r F
+GLIBC_2.27 fgetspent F
+GLIBC_2.27 fgetspent_r F
+GLIBC_2.27 fgetwc F
+GLIBC_2.27 fgetwc_unlocked F
+GLIBC_2.27 fgetws F
+GLIBC_2.27 fgetws_unlocked F
+GLIBC_2.27 fgetxattr F
+GLIBC_2.27 fileno F
+GLIBC_2.27 fileno_unlocked F
+GLIBC_2.27 finite F
+GLIBC_2.27 finitef F
+GLIBC_2.27 finitel F
+GLIBC_2.27 flistxattr F
+GLIBC_2.27 flock F
+GLIBC_2.27 flockfile F
+GLIBC_2.27 fmemopen F
+GLIBC_2.27 fmtmsg F
+GLIBC_2.27 fnmatch F
+GLIBC_2.27 fopen F
+GLIBC_2.27 fopen64 F
+GLIBC_2.27 fopencookie F
+GLIBC_2.27 fork F
+GLIBC_2.27 fpathconf F
+GLIBC_2.27 fprintf F
+GLIBC_2.27 fputc F
+GLIBC_2.27 fputc_unlocked F
+GLIBC_2.27 fputs F
+GLIBC_2.27 fputs_unlocked F
+GLIBC_2.27 fputwc F
+GLIBC_2.27 fputwc_unlocked F
+GLIBC_2.27 fputws F
+GLIBC_2.27 fputws_unlocked F
+GLIBC_2.27 fread F
+GLIBC_2.27 fread_unlocked F
+GLIBC_2.27 free F
+GLIBC_2.27 freeaddrinfo F
+GLIBC_2.27 freeifaddrs F
+GLIBC_2.27 freelocale F
+GLIBC_2.27 fremovexattr F
+GLIBC_2.27 freopen F
+GLIBC_2.27 freopen64 F
+GLIBC_2.27 frexp F
+GLIBC_2.27 frexpf F
+GLIBC_2.27 frexpl F
+GLIBC_2.27 fscanf F
+GLIBC_2.27 fseek F
+GLIBC_2.27 fseeko F
+GLIBC_2.27 fseeko64 F
+GLIBC_2.27 fsetpos F
+GLIBC_2.27 fsetpos64 F
+GLIBC_2.27 fsetxattr F
+GLIBC_2.27 fstatfs F
+GLIBC_2.27 fstatfs64 F
+GLIBC_2.27 fstatvfs F
+GLIBC_2.27 fstatvfs64 F
+GLIBC_2.27 fsync F
+GLIBC_2.27 ftell F
+GLIBC_2.27 ftello F
+GLIBC_2.27 ftello64 F
+GLIBC_2.27 ftime F
+GLIBC_2.27 ftok F
+GLIBC_2.27 ftruncate F
+GLIBC_2.27 ftruncate64 F
+GLIBC_2.27 ftrylockfile F
+GLIBC_2.27 fts64_children F
+GLIBC_2.27 fts64_close F
+GLIBC_2.27 fts64_open F
+GLIBC_2.27 fts64_read F
+GLIBC_2.27 fts64_set F
+GLIBC_2.27 fts_children F
+GLIBC_2.27 fts_close F
+GLIBC_2.27 fts_open F
+GLIBC_2.27 fts_read F
+GLIBC_2.27 fts_set F
+GLIBC_2.27 ftw F
+GLIBC_2.27 ftw64 F
+GLIBC_2.27 funlockfile F
+GLIBC_2.27 futimens F
+GLIBC_2.27 futimes F
+GLIBC_2.27 futimesat F
+GLIBC_2.27 fwide F
+GLIBC_2.27 fwprintf F
+GLIBC_2.27 fwrite F
+GLIBC_2.27 fwrite_unlocked F
+GLIBC_2.27 fwscanf F
+GLIBC_2.27 gai_strerror F
+GLIBC_2.27 gcvt F
+GLIBC_2.27 get_avphys_pages F
+GLIBC_2.27 get_current_dir_name F
+GLIBC_2.27 get_myaddress F
+GLIBC_2.27 get_nprocs F
+GLIBC_2.27 get_nprocs_conf F
+GLIBC_2.27 get_phys_pages F
+GLIBC_2.27 getaddrinfo F
+GLIBC_2.27 getaliasbyname F
+GLIBC_2.27 getaliasbyname_r F
+GLIBC_2.27 getaliasent F
+GLIBC_2.27 getaliasent_r F
+GLIBC_2.27 getauxval F
+GLIBC_2.27 getc F
+GLIBC_2.27 getc_unlocked F
+GLIBC_2.27 getchar F
+GLIBC_2.27 getchar_unlocked F
+GLIBC_2.27 getcontext F
+GLIBC_2.27 getcwd F
+GLIBC_2.27 getdate F
+GLIBC_2.27 getdate_err D 0x4
+GLIBC_2.27 getdate_r F
+GLIBC_2.27 getdelim F
+GLIBC_2.27 getdirentries F
+GLIBC_2.27 getdirentries64 F
+GLIBC_2.27 getdomainname F
+GLIBC_2.27 getdtablesize F
+GLIBC_2.27 getegid F
+GLIBC_2.27 getentropy F
+GLIBC_2.27 getenv F
+GLIBC_2.27 geteuid F
+GLIBC_2.27 getfsent F
+GLIBC_2.27 getfsfile F
+GLIBC_2.27 getfsspec F
+GLIBC_2.27 getgid F
+GLIBC_2.27 getgrent F
+GLIBC_2.27 getgrent_r F
+GLIBC_2.27 getgrgid F
+GLIBC_2.27 getgrgid_r F
+GLIBC_2.27 getgrnam F
+GLIBC_2.27 getgrnam_r F
+GLIBC_2.27 getgrouplist F
+GLIBC_2.27 getgroups F
+GLIBC_2.27 gethostbyaddr F
+GLIBC_2.27 gethostbyaddr_r F
+GLIBC_2.27 gethostbyname F
+GLIBC_2.27 gethostbyname2 F
+GLIBC_2.27 gethostbyname2_r F
+GLIBC_2.27 gethostbyname_r F
+GLIBC_2.27 gethostent F
+GLIBC_2.27 gethostent_r F
+GLIBC_2.27 gethostid F
+GLIBC_2.27 gethostname F
+GLIBC_2.27 getifaddrs F
+GLIBC_2.27 getipv4sourcefilter F
+GLIBC_2.27 getitimer F
+GLIBC_2.27 getline F
+GLIBC_2.27 getloadavg F
+GLIBC_2.27 getlogin F
+GLIBC_2.27 getlogin_r F
+GLIBC_2.27 getmntent F
+GLIBC_2.27 getmntent_r F
+GLIBC_2.27 getmsg F
+GLIBC_2.27 getnameinfo F
+GLIBC_2.27 getnetbyaddr F
+GLIBC_2.27 getnetbyaddr_r F
+GLIBC_2.27 getnetbyname F
+GLIBC_2.27 getnetbyname_r F
+GLIBC_2.27 getnetent F
+GLIBC_2.27 getnetent_r F
+GLIBC_2.27 getnetgrent F
+GLIBC_2.27 getnetgrent_r F
+GLIBC_2.27 getnetname F
+GLIBC_2.27 getopt F
+GLIBC_2.27 getopt_long F
+GLIBC_2.27 getopt_long_only F
+GLIBC_2.27 getpagesize F
+GLIBC_2.27 getpass F
+GLIBC_2.27 getpeername F
+GLIBC_2.27 getpgid F
+GLIBC_2.27 getpgrp F
+GLIBC_2.27 getpid F
+GLIBC_2.27 getpmsg F
+GLIBC_2.27 getppid F
+GLIBC_2.27 getpriority F
+GLIBC_2.27 getprotobyname F
+GLIBC_2.27 getprotobyname_r F
+GLIBC_2.27 getprotobynumber F
+GLIBC_2.27 getprotobynumber_r F
+GLIBC_2.27 getprotoent F
+GLIBC_2.27 getprotoent_r F
+GLIBC_2.27 getpt F
+GLIBC_2.27 getpublickey F
+GLIBC_2.27 getpw F
+GLIBC_2.27 getpwent F
+GLIBC_2.27 getpwent_r F
+GLIBC_2.27 getpwnam F
+GLIBC_2.27 getpwnam_r F
+GLIBC_2.27 getpwuid F
+GLIBC_2.27 getpwuid_r F
+GLIBC_2.27 getrandom F
+GLIBC_2.27 getresgid F
+GLIBC_2.27 getresuid F
+GLIBC_2.27 getrlimit F
+GLIBC_2.27 getrlimit64 F
+GLIBC_2.27 getrpcbyname F
+GLIBC_2.27 getrpcbyname_r F
+GLIBC_2.27 getrpcbynumber F
+GLIBC_2.27 getrpcbynumber_r F
+GLIBC_2.27 getrpcent F
+GLIBC_2.27 getrpcent_r F
+GLIBC_2.27 getrpcport F
+GLIBC_2.27 getrusage F
+GLIBC_2.27 gets F
+GLIBC_2.27 getsecretkey F
+GLIBC_2.27 getservbyname F
+GLIBC_2.27 getservbyname_r F
+GLIBC_2.27 getservbyport F
+GLIBC_2.27 getservbyport_r F
+GLIBC_2.27 getservent F
+GLIBC_2.27 getservent_r F
+GLIBC_2.27 getsgent F
+GLIBC_2.27 getsgent_r F
+GLIBC_2.27 getsgnam F
+GLIBC_2.27 getsgnam_r F
+GLIBC_2.27 getsid F
+GLIBC_2.27 getsockname F
+GLIBC_2.27 getsockopt F
+GLIBC_2.27 getsourcefilter F
+GLIBC_2.27 getspent F
+GLIBC_2.27 getspent_r F
+GLIBC_2.27 getspnam F
+GLIBC_2.27 getspnam_r F
+GLIBC_2.27 getsubopt F
+GLIBC_2.27 gettext F
+GLIBC_2.27 gettimeofday F
+GLIBC_2.27 getttyent F
+GLIBC_2.27 getttynam F
+GLIBC_2.27 getuid F
+GLIBC_2.27 getusershell F
+GLIBC_2.27 getutent F
+GLIBC_2.27 getutent_r F
+GLIBC_2.27 getutid F
+GLIBC_2.27 getutid_r F
+GLIBC_2.27 getutline F
+GLIBC_2.27 getutline_r F
+GLIBC_2.27 getutmp F
+GLIBC_2.27 getutmpx F
+GLIBC_2.27 getutxent F
+GLIBC_2.27 getutxid F
+GLIBC_2.27 getutxline F
+GLIBC_2.27 getw F
+GLIBC_2.27 getwc F
+GLIBC_2.27 getwc_unlocked F
+GLIBC_2.27 getwchar F
+GLIBC_2.27 getwchar_unlocked F
+GLIBC_2.27 getwd F
+GLIBC_2.27 getxattr F
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
+GLIBC_2.27 glob_pattern_p F
+GLIBC_2.27 globfree F
+GLIBC_2.27 globfree64 F
+GLIBC_2.27 gmtime F
+GLIBC_2.27 gmtime_r F
+GLIBC_2.27 gnu_dev_major F
+GLIBC_2.27 gnu_dev_makedev F
+GLIBC_2.27 gnu_dev_minor F
+GLIBC_2.27 gnu_get_libc_release F
+GLIBC_2.27 gnu_get_libc_version F
+GLIBC_2.27 grantpt F
+GLIBC_2.27 group_member F
+GLIBC_2.27 gsignal F
+GLIBC_2.27 gtty F
+GLIBC_2.27 h_errlist D 0x14
+GLIBC_2.27 h_nerr D 0x4
+GLIBC_2.27 hasmntopt F
+GLIBC_2.27 hcreate F
+GLIBC_2.27 hcreate_r F
+GLIBC_2.27 hdestroy F
+GLIBC_2.27 hdestroy_r F
+GLIBC_2.27 herror F
+GLIBC_2.27 host2netname F
+GLIBC_2.27 hsearch F
+GLIBC_2.27 hsearch_r F
+GLIBC_2.27 hstrerror F
+GLIBC_2.27 htonl F
+GLIBC_2.27 htons F
+GLIBC_2.27 iconv F
+GLIBC_2.27 iconv_close F
+GLIBC_2.27 iconv_open F
+GLIBC_2.27 if_freenameindex F
+GLIBC_2.27 if_indextoname F
+GLIBC_2.27 if_nameindex F
+GLIBC_2.27 if_nametoindex F
+GLIBC_2.27 imaxabs F
+GLIBC_2.27 imaxdiv F
+GLIBC_2.27 in6addr_any D 0x10
+GLIBC_2.27 in6addr_loopback D 0x10
+GLIBC_2.27 index F
+GLIBC_2.27 inet6_opt_append F
+GLIBC_2.27 inet6_opt_find F
+GLIBC_2.27 inet6_opt_finish F
+GLIBC_2.27 inet6_opt_get_val F
+GLIBC_2.27 inet6_opt_init F
+GLIBC_2.27 inet6_opt_next F
+GLIBC_2.27 inet6_opt_set_val F
+GLIBC_2.27 inet6_option_alloc F
+GLIBC_2.27 inet6_option_append F
+GLIBC_2.27 inet6_option_find F
+GLIBC_2.27 inet6_option_init F
+GLIBC_2.27 inet6_option_next F
+GLIBC_2.27 inet6_option_space F
+GLIBC_2.27 inet6_rth_add F
+GLIBC_2.27 inet6_rth_getaddr F
+GLIBC_2.27 inet6_rth_init F
+GLIBC_2.27 inet6_rth_reverse F
+GLIBC_2.27 inet6_rth_segments F
+GLIBC_2.27 inet6_rth_space F
+GLIBC_2.27 inet_addr F
+GLIBC_2.27 inet_aton F
+GLIBC_2.27 inet_lnaof F
+GLIBC_2.27 inet_makeaddr F
+GLIBC_2.27 inet_netof F
+GLIBC_2.27 inet_network F
+GLIBC_2.27 inet_nsap_addr F
+GLIBC_2.27 inet_nsap_ntoa F
+GLIBC_2.27 inet_ntoa F
+GLIBC_2.27 inet_ntop F
+GLIBC_2.27 inet_pton F
+GLIBC_2.27 init_module F
+GLIBC_2.27 initgroups F
+GLIBC_2.27 initstate F
+GLIBC_2.27 initstate_r F
+GLIBC_2.27 innetgr F
+GLIBC_2.27 inotify_add_watch F
+GLIBC_2.27 inotify_init F
+GLIBC_2.27 inotify_init1 F
+GLIBC_2.27 inotify_rm_watch F
+GLIBC_2.27 insque F
+GLIBC_2.27 ioctl F
+GLIBC_2.27 iruserok F
+GLIBC_2.27 iruserok_af F
+GLIBC_2.27 isalnum F
+GLIBC_2.27 isalnum_l F
+GLIBC_2.27 isalpha F
+GLIBC_2.27 isalpha_l F
+GLIBC_2.27 isascii F
+GLIBC_2.27 isastream F
+GLIBC_2.27 isatty F
+GLIBC_2.27 isblank F
+GLIBC_2.27 isblank_l F
+GLIBC_2.27 iscntrl F
+GLIBC_2.27 iscntrl_l F
+GLIBC_2.27 isctype F
+GLIBC_2.27 isdigit F
+GLIBC_2.27 isdigit_l F
+GLIBC_2.27 isfdtype F
+GLIBC_2.27 isgraph F
+GLIBC_2.27 isgraph_l F
+GLIBC_2.27 isinf F
+GLIBC_2.27 isinff F
+GLIBC_2.27 isinfl F
+GLIBC_2.27 islower F
+GLIBC_2.27 islower_l F
+GLIBC_2.27 isnan F
+GLIBC_2.27 isnanf F
+GLIBC_2.27 isnanl F
+GLIBC_2.27 isprint F
+GLIBC_2.27 isprint_l F
+GLIBC_2.27 ispunct F
+GLIBC_2.27 ispunct_l F
+GLIBC_2.27 isspace F
+GLIBC_2.27 isspace_l F
+GLIBC_2.27 isupper F
+GLIBC_2.27 isupper_l F
+GLIBC_2.27 iswalnum F
+GLIBC_2.27 iswalnum_l F
+GLIBC_2.27 iswalpha F
+GLIBC_2.27 iswalpha_l F
+GLIBC_2.27 iswblank F
+GLIBC_2.27 iswblank_l F
+GLIBC_2.27 iswcntrl F
+GLIBC_2.27 iswcntrl_l F
+GLIBC_2.27 iswctype F
+GLIBC_2.27 iswctype_l F
+GLIBC_2.27 iswdigit F
+GLIBC_2.27 iswdigit_l F
+GLIBC_2.27 iswgraph F
+GLIBC_2.27 iswgraph_l F
+GLIBC_2.27 iswlower F
+GLIBC_2.27 iswlower_l F
+GLIBC_2.27 iswprint F
+GLIBC_2.27 iswprint_l F
+GLIBC_2.27 iswpunct F
+GLIBC_2.27 iswpunct_l F
+GLIBC_2.27 iswspace F
+GLIBC_2.27 iswspace_l F
+GLIBC_2.27 iswupper F
+GLIBC_2.27 iswupper_l F
+GLIBC_2.27 iswxdigit F
+GLIBC_2.27 iswxdigit_l F
+GLIBC_2.27 isxdigit F
+GLIBC_2.27 isxdigit_l F
+GLIBC_2.27 jrand48 F
+GLIBC_2.27 jrand48_r F
+GLIBC_2.27 key_decryptsession F
+GLIBC_2.27 key_decryptsession_pk F
+GLIBC_2.27 key_encryptsession F
+GLIBC_2.27 key_encryptsession_pk F
+GLIBC_2.27 key_gendes F
+GLIBC_2.27 key_get_conv F
+GLIBC_2.27 key_secretkey_is_set F
+GLIBC_2.27 key_setnet F
+GLIBC_2.27 key_setsecret F
+GLIBC_2.27 kill F
+GLIBC_2.27 killpg F
+GLIBC_2.27 klogctl F
+GLIBC_2.27 l64a F
+GLIBC_2.27 labs F
+GLIBC_2.27 lchmod F
+GLIBC_2.27 lchown F
+GLIBC_2.27 lckpwdf F
+GLIBC_2.27 lcong48 F
+GLIBC_2.27 lcong48_r F
+GLIBC_2.27 ldexp F
+GLIBC_2.27 ldexpf F
+GLIBC_2.27 ldexpl F
+GLIBC_2.27 ldiv F
+GLIBC_2.27 lfind F
+GLIBC_2.27 lgetxattr F
+GLIBC_2.27 link F
+GLIBC_2.27 linkat F
+GLIBC_2.27 listen F
+GLIBC_2.27 listxattr F
+GLIBC_2.27 llabs F
+GLIBC_2.27 lldiv F
+GLIBC_2.27 llistxattr F
+GLIBC_2.27 llseek F
+GLIBC_2.27 localeconv F
+GLIBC_2.27 localtime F
+GLIBC_2.27 localtime_r F
+GLIBC_2.27 lockf F
+GLIBC_2.27 lockf64 F
+GLIBC_2.27 longjmp F
+GLIBC_2.27 lrand48 F
+GLIBC_2.27 lrand48_r F
+GLIBC_2.27 lremovexattr F
+GLIBC_2.27 lsearch F
+GLIBC_2.27 lseek F
+GLIBC_2.27 lseek64 F
+GLIBC_2.27 lsetxattr F
+GLIBC_2.27 lutimes F
+GLIBC_2.27 madvise F
+GLIBC_2.27 makecontext F
+GLIBC_2.27 mallinfo F
+GLIBC_2.27 malloc F
+GLIBC_2.27 malloc_info F
+GLIBC_2.27 malloc_stats F
+GLIBC_2.27 malloc_trim F
+GLIBC_2.27 malloc_usable_size F
+GLIBC_2.27 mallopt F
+GLIBC_2.27 mallwatch D 0x4
+GLIBC_2.27 mblen F
+GLIBC_2.27 mbrlen F
+GLIBC_2.27 mbrtoc16 F
+GLIBC_2.27 mbrtoc32 F
+GLIBC_2.27 mbrtowc F
+GLIBC_2.27 mbsinit F
+GLIBC_2.27 mbsnrtowcs F
+GLIBC_2.27 mbsrtowcs F
+GLIBC_2.27 mbstowcs F
+GLIBC_2.27 mbtowc F
+GLIBC_2.27 mcheck F
+GLIBC_2.27 mcheck_check_all F
+GLIBC_2.27 mcheck_pedantic F
+GLIBC_2.27 mcount F
+GLIBC_2.27 memalign F
+GLIBC_2.27 memccpy F
+GLIBC_2.27 memchr F
+GLIBC_2.27 memcmp F
+GLIBC_2.27 memcpy F
+GLIBC_2.27 memfd_create F
+GLIBC_2.27 memfrob F
+GLIBC_2.27 memmem F
+GLIBC_2.27 memmove F
+GLIBC_2.27 mempcpy F
+GLIBC_2.27 memrchr F
+GLIBC_2.27 memset F
+GLIBC_2.27 mincore F
+GLIBC_2.27 mkdir F
+GLIBC_2.27 mkdirat F
+GLIBC_2.27 mkdtemp F
+GLIBC_2.27 mkfifo F
+GLIBC_2.27 mkfifoat F
+GLIBC_2.27 mkostemp F
+GLIBC_2.27 mkostemp64 F
+GLIBC_2.27 mkostemps F
+GLIBC_2.27 mkostemps64 F
+GLIBC_2.27 mkstemp F
+GLIBC_2.27 mkstemp64 F
+GLIBC_2.27 mkstemps F
+GLIBC_2.27 mkstemps64 F
+GLIBC_2.27 mktemp F
+GLIBC_2.27 mktime F
+GLIBC_2.27 mlock F
+GLIBC_2.27 mlock2 F
+GLIBC_2.27 mlockall F
+GLIBC_2.27 mmap F
+GLIBC_2.27 mmap64 F
+GLIBC_2.27 modf F
+GLIBC_2.27 modff F
+GLIBC_2.27 modfl F
+GLIBC_2.27 moncontrol F
+GLIBC_2.27 monstartup F
+GLIBC_2.27 mount F
+GLIBC_2.27 mprobe F
+GLIBC_2.27 mprotect F
+GLIBC_2.27 mrand48 F
+GLIBC_2.27 mrand48_r F
+GLIBC_2.27 mremap F
+GLIBC_2.27 msgctl F
+GLIBC_2.27 msgget F
+GLIBC_2.27 msgrcv F
+GLIBC_2.27 msgsnd F
+GLIBC_2.27 msync F
+GLIBC_2.27 mtrace F
+GLIBC_2.27 munlock F
+GLIBC_2.27 munlockall F
+GLIBC_2.27 munmap F
+GLIBC_2.27 muntrace F
+GLIBC_2.27 name_to_handle_at F
+GLIBC_2.27 nanosleep F
+GLIBC_2.27 netname2host F
+GLIBC_2.27 netname2user F
+GLIBC_2.27 newlocale F
+GLIBC_2.27 nfsservctl F
+GLIBC_2.27 nftw F
+GLIBC_2.27 nftw64 F
+GLIBC_2.27 ngettext F
+GLIBC_2.27 nice F
+GLIBC_2.27 nl_langinfo F
+GLIBC_2.27 nl_langinfo_l F
+GLIBC_2.27 nrand48 F
+GLIBC_2.27 nrand48_r F
+GLIBC_2.27 ntohl F
+GLIBC_2.27 ntohs F
+GLIBC_2.27 ntp_adjtime F
+GLIBC_2.27 ntp_gettime F
+GLIBC_2.27 ntp_gettimex F
+GLIBC_2.27 obstack_alloc_failed_handler D 0x4
+GLIBC_2.27 obstack_exit_failure D 0x4
+GLIBC_2.27 obstack_free F
+GLIBC_2.27 obstack_printf F
+GLIBC_2.27 obstack_vprintf F
+GLIBC_2.27 on_exit F
+GLIBC_2.27 open F
+GLIBC_2.27 open64 F
+GLIBC_2.27 open_by_handle_at F
+GLIBC_2.27 open_memstream F
+GLIBC_2.27 open_wmemstream F
+GLIBC_2.27 openat F
+GLIBC_2.27 openat64 F
+GLIBC_2.27 opendir F
+GLIBC_2.27 openlog F
+GLIBC_2.27 optarg D 0x4
+GLIBC_2.27 opterr D 0x4
+GLIBC_2.27 optind D 0x4
+GLIBC_2.27 optopt D 0x4
+GLIBC_2.27 parse_printf_format F
+GLIBC_2.27 passwd2des F
+GLIBC_2.27 pathconf F
+GLIBC_2.27 pause F
+GLIBC_2.27 pclose F
+GLIBC_2.27 perror F
+GLIBC_2.27 personality F
+GLIBC_2.27 pipe F
+GLIBC_2.27 pipe2 F
+GLIBC_2.27 pivot_root F
+GLIBC_2.27 pkey_alloc F
+GLIBC_2.27 pkey_free F
+GLIBC_2.27 pkey_get F
+GLIBC_2.27 pkey_mprotect F
+GLIBC_2.27 pkey_set F
+GLIBC_2.27 pmap_getmaps F
+GLIBC_2.27 pmap_getport F
+GLIBC_2.27 pmap_rmtcall F
+GLIBC_2.27 pmap_set F
+GLIBC_2.27 pmap_unset F
+GLIBC_2.27 poll F
+GLIBC_2.27 popen F
+GLIBC_2.27 posix_fadvise F
+GLIBC_2.27 posix_fadvise64 F
+GLIBC_2.27 posix_fallocate F
+GLIBC_2.27 posix_fallocate64 F
+GLIBC_2.27 posix_madvise F
+GLIBC_2.27 posix_memalign F
+GLIBC_2.27 posix_openpt F
+GLIBC_2.27 posix_spawn F
+GLIBC_2.27 posix_spawn_file_actions_addclose F
+GLIBC_2.27 posix_spawn_file_actions_adddup2 F
+GLIBC_2.27 posix_spawn_file_actions_addopen F
+GLIBC_2.27 posix_spawn_file_actions_destroy F
+GLIBC_2.27 posix_spawn_file_actions_init F
+GLIBC_2.27 posix_spawnattr_destroy F
+GLIBC_2.27 posix_spawnattr_getflags F
+GLIBC_2.27 posix_spawnattr_getpgroup F
+GLIBC_2.27 posix_spawnattr_getschedparam F
+GLIBC_2.27 posix_spawnattr_getschedpolicy F
+GLIBC_2.27 posix_spawnattr_getsigdefault F
+GLIBC_2.27 posix_spawnattr_getsigmask F
+GLIBC_2.27 posix_spawnattr_init F
+GLIBC_2.27 posix_spawnattr_setflags F
+GLIBC_2.27 posix_spawnattr_setpgroup F
+GLIBC_2.27 posix_spawnattr_setschedparam F
+GLIBC_2.27 posix_spawnattr_setschedpolicy F
+GLIBC_2.27 posix_spawnattr_setsigdefault F
+GLIBC_2.27 posix_spawnattr_setsigmask F
+GLIBC_2.27 posix_spawnp F
+GLIBC_2.27 ppoll F
+GLIBC_2.27 prctl F
+GLIBC_2.27 pread F
+GLIBC_2.27 pread64 F
+GLIBC_2.27 preadv F
+GLIBC_2.27 preadv2 F
+GLIBC_2.27 preadv64 F
+GLIBC_2.27 preadv64v2 F
+GLIBC_2.27 printf F
+GLIBC_2.27 printf_size F
+GLIBC_2.27 printf_size_info F
+GLIBC_2.27 prlimit F
+GLIBC_2.27 prlimit64 F
+GLIBC_2.27 process_vm_readv F
+GLIBC_2.27 process_vm_writev F
+GLIBC_2.27 profil F
+GLIBC_2.27 profil_counter F
+GLIBC_2.27 program_invocation_name D 0x4
+GLIBC_2.27 program_invocation_short_name D 0x4
+GLIBC_2.27 pselect F
+GLIBC_2.27 psiginfo F
+GLIBC_2.27 psignal F
+GLIBC_2.27 pthread_attr_destroy F
+GLIBC_2.27 pthread_attr_getdetachstate F
+GLIBC_2.27 pthread_attr_getinheritsched F
+GLIBC_2.27 pthread_attr_getschedparam F
+GLIBC_2.27 pthread_attr_getschedpolicy F
+GLIBC_2.27 pthread_attr_getscope F
+GLIBC_2.27 pthread_attr_init F
+GLIBC_2.27 pthread_attr_setdetachstate F
+GLIBC_2.27 pthread_attr_setinheritsched F
+GLIBC_2.27 pthread_attr_setschedparam F
+GLIBC_2.27 pthread_attr_setschedpolicy F
+GLIBC_2.27 pthread_attr_setscope F
+GLIBC_2.27 pthread_cond_broadcast F
+GLIBC_2.27 pthread_cond_destroy F
+GLIBC_2.27 pthread_cond_init F
+GLIBC_2.27 pthread_cond_signal F
+GLIBC_2.27 pthread_cond_timedwait F
+GLIBC_2.27 pthread_cond_wait F
+GLIBC_2.27 pthread_condattr_destroy F
+GLIBC_2.27 pthread_condattr_init F
+GLIBC_2.27 pthread_equal F
+GLIBC_2.27 pthread_exit F
+GLIBC_2.27 pthread_getschedparam F
+GLIBC_2.27 pthread_mutex_destroy F
+GLIBC_2.27 pthread_mutex_init F
+GLIBC_2.27 pthread_mutex_lock F
+GLIBC_2.27 pthread_mutex_unlock F
+GLIBC_2.27 pthread_self F
+GLIBC_2.27 pthread_setcancelstate F
+GLIBC_2.27 pthread_setcanceltype F
+GLIBC_2.27 pthread_setschedparam F
+GLIBC_2.27 ptrace F
+GLIBC_2.27 ptsname F
+GLIBC_2.27 ptsname_r F
+GLIBC_2.27 putc F
+GLIBC_2.27 putc_unlocked F
+GLIBC_2.27 putchar F
+GLIBC_2.27 putchar_unlocked F
+GLIBC_2.27 putenv F
+GLIBC_2.27 putgrent F
+GLIBC_2.27 putmsg F
+GLIBC_2.27 putpmsg F
+GLIBC_2.27 putpwent F
+GLIBC_2.27 puts F
+GLIBC_2.27 putsgent F
+GLIBC_2.27 putspent F
+GLIBC_2.27 pututline F
+GLIBC_2.27 pututxline F
+GLIBC_2.27 putw F
+GLIBC_2.27 putwc F
+GLIBC_2.27 putwc_unlocked F
+GLIBC_2.27 putwchar F
+GLIBC_2.27 putwchar_unlocked F
+GLIBC_2.27 pvalloc F
+GLIBC_2.27 pwrite F
+GLIBC_2.27 pwrite64 F
+GLIBC_2.27 pwritev F
+GLIBC_2.27 pwritev2 F
+GLIBC_2.27 pwritev64 F
+GLIBC_2.27 pwritev64v2 F
+GLIBC_2.27 qecvt F
+GLIBC_2.27 qecvt_r F
+GLIBC_2.27 qfcvt F
+GLIBC_2.27 qfcvt_r F
+GLIBC_2.27 qgcvt F
+GLIBC_2.27 qsort F
+GLIBC_2.27 qsort_r F
+GLIBC_2.27 quick_exit F
+GLIBC_2.27 quotactl F
+GLIBC_2.27 raise F
+GLIBC_2.27 rand F
+GLIBC_2.27 rand_r F
+GLIBC_2.27 random F
+GLIBC_2.27 random_r F
+GLIBC_2.27 rawmemchr F
+GLIBC_2.27 rcmd F
+GLIBC_2.27 rcmd_af F
+GLIBC_2.27 re_comp F
+GLIBC_2.27 re_compile_fastmap F
+GLIBC_2.27 re_compile_pattern F
+GLIBC_2.27 re_exec F
+GLIBC_2.27 re_match F
+GLIBC_2.27 re_match_2 F
+GLIBC_2.27 re_search F
+GLIBC_2.27 re_search_2 F
+GLIBC_2.27 re_set_registers F
+GLIBC_2.27 re_set_syntax F
+GLIBC_2.27 re_syntax_options D 0x4
+GLIBC_2.27 read F
+GLIBC_2.27 readahead F
+GLIBC_2.27 readdir F
+GLIBC_2.27 readdir64 F
+GLIBC_2.27 readdir64_r F
+GLIBC_2.27 readdir_r F
+GLIBC_2.27 readlink F
+GLIBC_2.27 readlinkat F
+GLIBC_2.27 readv F
+GLIBC_2.27 realloc F
+GLIBC_2.27 reallocarray F
+GLIBC_2.27 realpath F
+GLIBC_2.27 reboot F
+GLIBC_2.27 recv F
+GLIBC_2.27 recvfrom F
+GLIBC_2.27 recvmmsg F
+GLIBC_2.27 recvmsg F
+GLIBC_2.27 regcomp F
+GLIBC_2.27 regerror F
+GLIBC_2.27 regexec F
+GLIBC_2.27 regfree F
+GLIBC_2.27 register_printf_function F
+GLIBC_2.27 register_printf_modifier F
+GLIBC_2.27 register_printf_specifier F
+GLIBC_2.27 register_printf_type F
+GLIBC_2.27 registerrpc F
+GLIBC_2.27 remap_file_pages F
+GLIBC_2.27 remove F
+GLIBC_2.27 removexattr F
+GLIBC_2.27 remque F
+GLIBC_2.27 rename F
+GLIBC_2.27 renameat F
+GLIBC_2.27 revoke F
+GLIBC_2.27 rewind F
+GLIBC_2.27 rewinddir F
+GLIBC_2.27 rexec F
+GLIBC_2.27 rexec_af F
+GLIBC_2.27 rexecoptions D 0x4
+GLIBC_2.27 rindex F
+GLIBC_2.27 rmdir F
+GLIBC_2.27 rpc_createerr D 0x10
+GLIBC_2.27 rpmatch F
+GLIBC_2.27 rresvport F
+GLIBC_2.27 rresvport_af F
+GLIBC_2.27 rtime F
+GLIBC_2.27 ruserok F
+GLIBC_2.27 ruserok_af F
+GLIBC_2.27 ruserpass F
+GLIBC_2.27 sbrk F
+GLIBC_2.27 scalbn F
+GLIBC_2.27 scalbnf F
+GLIBC_2.27 scalbnl F
+GLIBC_2.27 scandir F
+GLIBC_2.27 scandir64 F
+GLIBC_2.27 scandirat F
+GLIBC_2.27 scandirat64 F
+GLIBC_2.27 scanf F
+GLIBC_2.27 sched_get_priority_max F
+GLIBC_2.27 sched_get_priority_min F
+GLIBC_2.27 sched_getaffinity F
+GLIBC_2.27 sched_getcpu F
+GLIBC_2.27 sched_getparam F
+GLIBC_2.27 sched_getscheduler F
+GLIBC_2.27 sched_rr_get_interval F
+GLIBC_2.27 sched_setaffinity F
+GLIBC_2.27 sched_setparam F
+GLIBC_2.27 sched_setscheduler F
+GLIBC_2.27 sched_yield F
+GLIBC_2.27 secure_getenv F
+GLIBC_2.27 seed48 F
+GLIBC_2.27 seed48_r F
+GLIBC_2.27 seekdir F
+GLIBC_2.27 select F
+GLIBC_2.27 semctl F
+GLIBC_2.27 semget F
+GLIBC_2.27 semop F
+GLIBC_2.27 semtimedop F
+GLIBC_2.27 send F
+GLIBC_2.27 sendfile F
+GLIBC_2.27 sendfile64 F
+GLIBC_2.27 sendmmsg F
+GLIBC_2.27 sendmsg F
+GLIBC_2.27 sendto F
+GLIBC_2.27 setaliasent F
+GLIBC_2.27 setbuf F
+GLIBC_2.27 setbuffer F
+GLIBC_2.27 setcontext F
+GLIBC_2.27 setdomainname F
+GLIBC_2.27 setegid F
+GLIBC_2.27 setenv F
+GLIBC_2.27 seteuid F
+GLIBC_2.27 setfsent F
+GLIBC_2.27 setfsgid F
+GLIBC_2.27 setfsuid F
+GLIBC_2.27 setgid F
+GLIBC_2.27 setgrent F
+GLIBC_2.27 setgroups F
+GLIBC_2.27 sethostent F
+GLIBC_2.27 sethostid F
+GLIBC_2.27 sethostname F
+GLIBC_2.27 setipv4sourcefilter F
+GLIBC_2.27 setitimer F
+GLIBC_2.27 setjmp F
+GLIBC_2.27 setlinebuf F
+GLIBC_2.27 setlocale F
+GLIBC_2.27 setlogin F
+GLIBC_2.27 setlogmask F
+GLIBC_2.27 setmntent F
+GLIBC_2.27 setnetent F
+GLIBC_2.27 setnetgrent F
+GLIBC_2.27 setns F
+GLIBC_2.27 setpgid F
+GLIBC_2.27 setpgrp F
+GLIBC_2.27 setpriority F
+GLIBC_2.27 setprotoent F
+GLIBC_2.27 setpwent F
+GLIBC_2.27 setregid F
+GLIBC_2.27 setresgid F
+GLIBC_2.27 setresuid F
+GLIBC_2.27 setreuid F
+GLIBC_2.27 setrlimit F
+GLIBC_2.27 setrlimit64 F
+GLIBC_2.27 setrpcent F
+GLIBC_2.27 setservent F
+GLIBC_2.27 setsgent F
+GLIBC_2.27 setsid F
+GLIBC_2.27 setsockopt F
+GLIBC_2.27 setsourcefilter F
+GLIBC_2.27 setspent F
+GLIBC_2.27 setstate F
+GLIBC_2.27 setstate_r F
+GLIBC_2.27 settimeofday F
+GLIBC_2.27 setttyent F
+GLIBC_2.27 setuid F
+GLIBC_2.27 setusershell F
+GLIBC_2.27 setutent F
+GLIBC_2.27 setutxent F
+GLIBC_2.27 setvbuf F
+GLIBC_2.27 setxattr F
+GLIBC_2.27 sgetsgent F
+GLIBC_2.27 sgetsgent_r F
+GLIBC_2.27 sgetspent F
+GLIBC_2.27 sgetspent_r F
+GLIBC_2.27 shmat F
+GLIBC_2.27 shmctl F
+GLIBC_2.27 shmdt F
+GLIBC_2.27 shmget F
+GLIBC_2.27 shutdown F
+GLIBC_2.27 sigaction F
+GLIBC_2.27 sigaddset F
+GLIBC_2.27 sigaltstack F
+GLIBC_2.27 sigandset F
+GLIBC_2.27 sigblock F
+GLIBC_2.27 sigdelset F
+GLIBC_2.27 sigemptyset F
+GLIBC_2.27 sigfillset F
+GLIBC_2.27 siggetmask F
+GLIBC_2.27 sighold F
+GLIBC_2.27 sigignore F
+GLIBC_2.27 siginterrupt F
+GLIBC_2.27 sigisemptyset F
+GLIBC_2.27 sigismember F
+GLIBC_2.27 siglongjmp F
+GLIBC_2.27 signal F
+GLIBC_2.27 signalfd F
+GLIBC_2.27 sigorset F
+GLIBC_2.27 sigpause F
+GLIBC_2.27 sigpending F
+GLIBC_2.27 sigprocmask F
+GLIBC_2.27 sigqueue F
+GLIBC_2.27 sigrelse F
+GLIBC_2.27 sigreturn F
+GLIBC_2.27 sigset F
+GLIBC_2.27 sigsetmask F
+GLIBC_2.27 sigstack F
+GLIBC_2.27 sigsuspend F
+GLIBC_2.27 sigtimedwait F
+GLIBC_2.27 sigwait F
+GLIBC_2.27 sigwaitinfo F
+GLIBC_2.27 sleep F
+GLIBC_2.27 snprintf F
+GLIBC_2.27 sockatmark F
+GLIBC_2.27 socket F
+GLIBC_2.27 socketpair F
+GLIBC_2.27 splice F
+GLIBC_2.27 sprintf F
+GLIBC_2.27 sprofil F
+GLIBC_2.27 srand F
+GLIBC_2.27 srand48 F
+GLIBC_2.27 srand48_r F
+GLIBC_2.27 srandom F
+GLIBC_2.27 srandom_r F
+GLIBC_2.27 sscanf F
+GLIBC_2.27 ssignal F
+GLIBC_2.27 sstk F
+GLIBC_2.27 statfs F
+GLIBC_2.27 statfs64 F
+GLIBC_2.27 statvfs F
+GLIBC_2.27 statvfs64 F
+GLIBC_2.27 stderr D 0x4
+GLIBC_2.27 stdin D 0x4
+GLIBC_2.27 stdout D 0x4
+GLIBC_2.27 stime F
+GLIBC_2.27 stpcpy F
+GLIBC_2.27 stpncpy F
+GLIBC_2.27 strcasecmp F
+GLIBC_2.27 strcasecmp_l F
+GLIBC_2.27 strcasestr F
+GLIBC_2.27 strcat F
+GLIBC_2.27 strchr F
+GLIBC_2.27 strchrnul F
+GLIBC_2.27 strcmp F
+GLIBC_2.27 strcoll F
+GLIBC_2.27 strcoll_l F
+GLIBC_2.27 strcpy F
+GLIBC_2.27 strcspn F
+GLIBC_2.27 strdup F
+GLIBC_2.27 strerror F
+GLIBC_2.27 strerror_l F
+GLIBC_2.27 strerror_r F
+GLIBC_2.27 strfmon F
+GLIBC_2.27 strfmon_l F
+GLIBC_2.27 strfromd F
+GLIBC_2.27 strfromf F
+GLIBC_2.27 strfromf32 F
+GLIBC_2.27 strfromf32x F
+GLIBC_2.27 strfromf64 F
+GLIBC_2.27 strfroml F
+GLIBC_2.27 strfry F
+GLIBC_2.27 strftime F
+GLIBC_2.27 strftime_l F
+GLIBC_2.27 strlen F
+GLIBC_2.27 strncasecmp F
+GLIBC_2.27 strncasecmp_l F
+GLIBC_2.27 strncat F
+GLIBC_2.27 strncmp F
+GLIBC_2.27 strncpy F
+GLIBC_2.27 strndup F
+GLIBC_2.27 strnlen F
+GLIBC_2.27 strpbrk F
+GLIBC_2.27 strptime F
+GLIBC_2.27 strptime_l F
+GLIBC_2.27 strrchr F
+GLIBC_2.27 strsep F
+GLIBC_2.27 strsignal F
+GLIBC_2.27 strspn F
+GLIBC_2.27 strstr F
+GLIBC_2.27 strtod F
+GLIBC_2.27 strtod_l F
+GLIBC_2.27 strtof F
+GLIBC_2.27 strtof32 F
+GLIBC_2.27 strtof32_l F
+GLIBC_2.27 strtof32x F
+GLIBC_2.27 strtof32x_l F
+GLIBC_2.27 strtof64 F
+GLIBC_2.27 strtof64_l F
+GLIBC_2.27 strtof_l F
+GLIBC_2.27 strtoimax F
+GLIBC_2.27 strtok F
+GLIBC_2.27 strtok_r F
+GLIBC_2.27 strtol F
+GLIBC_2.27 strtol_l F
+GLIBC_2.27 strtold F
+GLIBC_2.27 strtold_l F
+GLIBC_2.27 strtoll F
+GLIBC_2.27 strtoll_l F
+GLIBC_2.27 strtoq F
+GLIBC_2.27 strtoul F
+GLIBC_2.27 strtoul_l F
+GLIBC_2.27 strtoull F
+GLIBC_2.27 strtoull_l F
+GLIBC_2.27 strtoumax F
+GLIBC_2.27 strtouq F
+GLIBC_2.27 strverscmp F
+GLIBC_2.27 strxfrm F
+GLIBC_2.27 strxfrm_l F
+GLIBC_2.27 stty F
+GLIBC_2.27 svc_exit F
+GLIBC_2.27 svc_fdset D 0x80
+GLIBC_2.27 svc_getreq F
+GLIBC_2.27 svc_getreq_common F
+GLIBC_2.27 svc_getreq_poll F
+GLIBC_2.27 svc_getreqset F
+GLIBC_2.27 svc_max_pollfd D 0x4
+GLIBC_2.27 svc_pollfd D 0x4
+GLIBC_2.27 svc_register F
+GLIBC_2.27 svc_run F
+GLIBC_2.27 svc_sendreply F
+GLIBC_2.27 svc_unregister F
+GLIBC_2.27 svcauthdes_stats D 0xc
+GLIBC_2.27 svcerr_auth F
+GLIBC_2.27 svcerr_decode F
+GLIBC_2.27 svcerr_noproc F
+GLIBC_2.27 svcerr_noprog F
+GLIBC_2.27 svcerr_progvers F
+GLIBC_2.27 svcerr_systemerr F
+GLIBC_2.27 svcerr_weakauth F
+GLIBC_2.27 svcfd_create F
+GLIBC_2.27 svcraw_create F
+GLIBC_2.27 svctcp_create F
+GLIBC_2.27 svcudp_bufcreate F
+GLIBC_2.27 svcudp_create F
+GLIBC_2.27 svcudp_enablecache F
+GLIBC_2.27 svcunix_create F
+GLIBC_2.27 svcunixfd_create F
+GLIBC_2.27 swab F
+GLIBC_2.27 swapcontext F
+GLIBC_2.27 swapoff F
+GLIBC_2.27 swapon F
+GLIBC_2.27 swprintf F
+GLIBC_2.27 swscanf F
+GLIBC_2.27 symlink F
+GLIBC_2.27 symlinkat F
+GLIBC_2.27 sync F
+GLIBC_2.27 sync_file_range F
+GLIBC_2.27 syncfs F
+GLIBC_2.27 sys_errlist D 0x218
+GLIBC_2.27 sys_nerr D 0x4
+GLIBC_2.27 sys_sigabbrev D 0x104
+GLIBC_2.27 sys_siglist D 0x104
+GLIBC_2.27 syscall F
+GLIBC_2.27 sysconf F
+GLIBC_2.27 sysctl F
+GLIBC_2.27 sysinfo F
+GLIBC_2.27 syslog F
+GLIBC_2.27 system F
+GLIBC_2.27 sysv_signal F
+GLIBC_2.27 tcdrain F
+GLIBC_2.27 tcflow F
+GLIBC_2.27 tcflush F
+GLIBC_2.27 tcgetattr F
+GLIBC_2.27 tcgetpgrp F
+GLIBC_2.27 tcgetsid F
+GLIBC_2.27 tcsendbreak F
+GLIBC_2.27 tcsetattr F
+GLIBC_2.27 tcsetpgrp F
+GLIBC_2.27 tdelete F
+GLIBC_2.27 tdestroy F
+GLIBC_2.27 tee F
+GLIBC_2.27 telldir F
+GLIBC_2.27 tempnam F
+GLIBC_2.27 textdomain F
+GLIBC_2.27 tfind F
+GLIBC_2.27 time F
+GLIBC_2.27 timegm F
+GLIBC_2.27 timelocal F
+GLIBC_2.27 timerfd_create F
+GLIBC_2.27 timerfd_gettime F
+GLIBC_2.27 timerfd_settime F
+GLIBC_2.27 times F
+GLIBC_2.27 timespec_get F
+GLIBC_2.27 timezone D 0x4
+GLIBC_2.27 tmpfile F
+GLIBC_2.27 tmpfile64 F
+GLIBC_2.27 tmpnam F
+GLIBC_2.27 tmpnam_r F
+GLIBC_2.27 toascii F
+GLIBC_2.27 tolower F
+GLIBC_2.27 tolower_l F
+GLIBC_2.27 toupper F
+GLIBC_2.27 toupper_l F
+GLIBC_2.27 towctrans F
+GLIBC_2.27 towctrans_l F
+GLIBC_2.27 towlower F
+GLIBC_2.27 towlower_l F
+GLIBC_2.27 towupper F
+GLIBC_2.27 towupper_l F
+GLIBC_2.27 tr_break F
+GLIBC_2.27 truncate F
+GLIBC_2.27 truncate64 F
+GLIBC_2.27 tsearch F
+GLIBC_2.27 ttyname F
+GLIBC_2.27 ttyname_r F
+GLIBC_2.27 ttyslot F
+GLIBC_2.27 twalk F
+GLIBC_2.27 tzname D 0x8
+GLIBC_2.27 tzset F
+GLIBC_2.27 ualarm F
+GLIBC_2.27 ulckpwdf F
+GLIBC_2.27 ulimit F
+GLIBC_2.27 umask F
+GLIBC_2.27 umount F
+GLIBC_2.27 umount2 F
+GLIBC_2.27 uname F
+GLIBC_2.27 ungetc F
+GLIBC_2.27 ungetwc F
+GLIBC_2.27 unlink F
+GLIBC_2.27 unlinkat F
+GLIBC_2.27 unlockpt F
+GLIBC_2.27 unsetenv F
+GLIBC_2.27 unshare F
+GLIBC_2.27 updwtmp F
+GLIBC_2.27 updwtmpx F
+GLIBC_2.27 uselocale F
+GLIBC_2.27 user2netname F
+GLIBC_2.27 usleep F
+GLIBC_2.27 ustat F
+GLIBC_2.27 utime F
+GLIBC_2.27 utimensat F
+GLIBC_2.27 utimes F
+GLIBC_2.27 utmpname F
+GLIBC_2.27 utmpxname F
+GLIBC_2.27 valloc F
+GLIBC_2.27 vasprintf F
+GLIBC_2.27 vdprintf F
+GLIBC_2.27 verr F
+GLIBC_2.27 verrx F
+GLIBC_2.27 versionsort F
+GLIBC_2.27 versionsort64 F
+GLIBC_2.27 vfork F
+GLIBC_2.27 vfprintf F
+GLIBC_2.27 vfscanf F
+GLIBC_2.27 vfwprintf F
+GLIBC_2.27 vfwscanf F
+GLIBC_2.27 vhangup F
+GLIBC_2.27 vlimit F
+GLIBC_2.27 vmsplice F
+GLIBC_2.27 vprintf F
+GLIBC_2.27 vscanf F
+GLIBC_2.27 vsnprintf F
+GLIBC_2.27 vsprintf F
+GLIBC_2.27 vsscanf F
+GLIBC_2.27 vswprintf F
+GLIBC_2.27 vswscanf F
+GLIBC_2.27 vsyslog F
+GLIBC_2.27 vtimes F
+GLIBC_2.27 vwarn F
+GLIBC_2.27 vwarnx F
+GLIBC_2.27 vwprintf F
+GLIBC_2.27 vwscanf F
+GLIBC_2.27 wait F
+GLIBC_2.27 wait3 F
+GLIBC_2.27 wait4 F
+GLIBC_2.27 waitid F
+GLIBC_2.27 waitpid F
+GLIBC_2.27 warn F
+GLIBC_2.27 warnx F
+GLIBC_2.27 wcpcpy F
+GLIBC_2.27 wcpncpy F
+GLIBC_2.27 wcrtomb F
+GLIBC_2.27 wcscasecmp F
+GLIBC_2.27 wcscasecmp_l F
+GLIBC_2.27 wcscat F
+GLIBC_2.27 wcschr F
+GLIBC_2.27 wcschrnul F
+GLIBC_2.27 wcscmp F
+GLIBC_2.27 wcscoll F
+GLIBC_2.27 wcscoll_l F
+GLIBC_2.27 wcscpy F
+GLIBC_2.27 wcscspn F
+GLIBC_2.27 wcsdup F
+GLIBC_2.27 wcsftime F
+GLIBC_2.27 wcsftime_l F
+GLIBC_2.27 wcslen F
+GLIBC_2.27 wcsncasecmp F
+GLIBC_2.27 wcsncasecmp_l F
+GLIBC_2.27 wcsncat F
+GLIBC_2.27 wcsncmp F
+GLIBC_2.27 wcsncpy F
+GLIBC_2.27 wcsnlen F
+GLIBC_2.27 wcsnrtombs F
+GLIBC_2.27 wcspbrk F
+GLIBC_2.27 wcsrchr F
+GLIBC_2.27 wcsrtombs F
+GLIBC_2.27 wcsspn F
+GLIBC_2.27 wcsstr F
+GLIBC_2.27 wcstod F
+GLIBC_2.27 wcstod_l F
+GLIBC_2.27 wcstof F
+GLIBC_2.27 wcstof32 F
+GLIBC_2.27 wcstof32_l F
+GLIBC_2.27 wcstof32x F
+GLIBC_2.27 wcstof32x_l F
+GLIBC_2.27 wcstof64 F
+GLIBC_2.27 wcstof64_l F
+GLIBC_2.27 wcstof_l F
+GLIBC_2.27 wcstoimax F
+GLIBC_2.27 wcstok F
+GLIBC_2.27 wcstol F
+GLIBC_2.27 wcstol_l F
+GLIBC_2.27 wcstold F
+GLIBC_2.27 wcstold_l F
+GLIBC_2.27 wcstoll F
+GLIBC_2.27 wcstoll_l F
+GLIBC_2.27 wcstombs F
+GLIBC_2.27 wcstoq F
+GLIBC_2.27 wcstoul F
+GLIBC_2.27 wcstoul_l F
+GLIBC_2.27 wcstoull F
+GLIBC_2.27 wcstoull_l F
+GLIBC_2.27 wcstoumax F
+GLIBC_2.27 wcstouq F
+GLIBC_2.27 wcswcs F
+GLIBC_2.27 wcswidth F
+GLIBC_2.27 wcsxfrm F
+GLIBC_2.27 wcsxfrm_l F
+GLIBC_2.27 wctob F
+GLIBC_2.27 wctomb F
+GLIBC_2.27 wctrans F
+GLIBC_2.27 wctrans_l F
+GLIBC_2.27 wctype F
+GLIBC_2.27 wctype_l F
+GLIBC_2.27 wcwidth F
+GLIBC_2.27 wmemchr F
+GLIBC_2.27 wmemcmp F
+GLIBC_2.27 wmemcpy F
+GLIBC_2.27 wmemmove F
+GLIBC_2.27 wmempcpy F
+GLIBC_2.27 wmemset F
+GLIBC_2.27 wordexp F
+GLIBC_2.27 wordfree F
+GLIBC_2.27 wprintf F
+GLIBC_2.27 write F
+GLIBC_2.27 writev F
+GLIBC_2.27 wscanf F
+GLIBC_2.27 xdecrypt F
+GLIBC_2.27 xdr_accepted_reply F
+GLIBC_2.27 xdr_array F
+GLIBC_2.27 xdr_authdes_cred F
+GLIBC_2.27 xdr_authdes_verf F
+GLIBC_2.27 xdr_authunix_parms F
+GLIBC_2.27 xdr_bool F
+GLIBC_2.27 xdr_bytes F
+GLIBC_2.27 xdr_callhdr F
+GLIBC_2.27 xdr_callmsg F
+GLIBC_2.27 xdr_char F
+GLIBC_2.27 xdr_cryptkeyarg F
+GLIBC_2.27 xdr_cryptkeyarg2 F
+GLIBC_2.27 xdr_cryptkeyres F
+GLIBC_2.27 xdr_des_block F
+GLIBC_2.27 xdr_double F
+GLIBC_2.27 xdr_enum F
+GLIBC_2.27 xdr_float F
+GLIBC_2.27 xdr_free F
+GLIBC_2.27 xdr_getcredres F
+GLIBC_2.27 xdr_hyper F
+GLIBC_2.27 xdr_int F
+GLIBC_2.27 xdr_int16_t F
+GLIBC_2.27 xdr_int32_t F
+GLIBC_2.27 xdr_int64_t F
+GLIBC_2.27 xdr_int8_t F
+GLIBC_2.27 xdr_key_netstarg F
+GLIBC_2.27 xdr_key_netstres F
+GLIBC_2.27 xdr_keybuf F
+GLIBC_2.27 xdr_keystatus F
+GLIBC_2.27 xdr_long F
+GLIBC_2.27 xdr_longlong_t F
+GLIBC_2.27 xdr_netnamestr F
+GLIBC_2.27 xdr_netobj F
+GLIBC_2.27 xdr_opaque F
+GLIBC_2.27 xdr_opaque_auth F
+GLIBC_2.27 xdr_pmap F
+GLIBC_2.27 xdr_pmaplist F
+GLIBC_2.27 xdr_pointer F
+GLIBC_2.27 xdr_quad_t F
+GLIBC_2.27 xdr_reference F
+GLIBC_2.27 xdr_rejected_reply F
+GLIBC_2.27 xdr_replymsg F
+GLIBC_2.27 xdr_rmtcall_args F
+GLIBC_2.27 xdr_rmtcallres F
+GLIBC_2.27 xdr_short F
+GLIBC_2.27 xdr_sizeof F
+GLIBC_2.27 xdr_string F
+GLIBC_2.27 xdr_u_char F
+GLIBC_2.27 xdr_u_hyper F
+GLIBC_2.27 xdr_u_int F
+GLIBC_2.27 xdr_u_long F
+GLIBC_2.27 xdr_u_longlong_t F
+GLIBC_2.27 xdr_u_quad_t F
+GLIBC_2.27 xdr_u_short F
+GLIBC_2.27 xdr_uint16_t F
+GLIBC_2.27 xdr_uint32_t F
+GLIBC_2.27 xdr_uint64_t F
+GLIBC_2.27 xdr_uint8_t F
+GLIBC_2.27 xdr_union F
+GLIBC_2.27 xdr_unixcred F
+GLIBC_2.27 xdr_vector F
+GLIBC_2.27 xdr_void F
+GLIBC_2.27 xdr_wrapstring F
+GLIBC_2.27 xdrmem_create F
+GLIBC_2.27 xdrrec_create F
+GLIBC_2.27 xdrrec_endofrecord F
+GLIBC_2.27 xdrrec_eof F
+GLIBC_2.27 xdrrec_skiprecord F
+GLIBC_2.27 xdrstdio_create F
+GLIBC_2.27 xencrypt F
+GLIBC_2.27 xprt_register F
+GLIBC_2.27 xprt_unregister F
diff --git a/sysdeps/unix/sysv/linux/csky/libcrypt.abilist b/sysdeps/unix/sysv/linux/csky/libcrypt.abilist
new file mode 100644
index 0000000..2fe2263
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libcrypt.abilist
@@ -0,0 +1,8 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 crypt F
+GLIBC_2.27 crypt_r F
+GLIBC_2.27 encrypt F
+GLIBC_2.27 encrypt_r F
+GLIBC_2.27 fcrypt F
+GLIBC_2.27 setkey F
+GLIBC_2.27 setkey_r F
diff --git a/sysdeps/unix/sysv/linux/csky/libdl.abilist b/sysdeps/unix/sysv/linux/csky/libdl.abilist
new file mode 100644
index 0000000..ea9b1e3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libdl.abilist
@@ -0,0 +1,10 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 dladdr F
+GLIBC_2.27 dladdr1 F
+GLIBC_2.27 dlclose F
+GLIBC_2.27 dlerror F
+GLIBC_2.27 dlinfo F
+GLIBC_2.27 dlmopen F
+GLIBC_2.27 dlopen F
+GLIBC_2.27 dlsym F
+GLIBC_2.27 dlvsym F
diff --git a/sysdeps/unix/sysv/linux/csky/libm.abilist b/sysdeps/unix/sysv/linux/csky/libm.abilist
new file mode 100644
index 0000000..0671486
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libm.abilist
@@ -0,0 +1,737 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 __acos_finite F
+GLIBC_2.27 __acosf_finite F
+GLIBC_2.27 __acosh_finite F
+GLIBC_2.27 __acoshf_finite F
+GLIBC_2.27 __asin_finite F
+GLIBC_2.27 __asinf_finite F
+GLIBC_2.27 __atan2_finite F
+GLIBC_2.27 __atan2f_finite F
+GLIBC_2.27 __atanh_finite F
+GLIBC_2.27 __atanhf_finite F
+GLIBC_2.27 __clog10 F
+GLIBC_2.27 __clog10f F
+GLIBC_2.27 __clog10l F
+GLIBC_2.27 __cosh_finite F
+GLIBC_2.27 __coshf_finite F
+GLIBC_2.27 __exp10_finite F
+GLIBC_2.27 __exp10f_finite F
+GLIBC_2.27 __exp2_finite F
+GLIBC_2.27 __exp2f_finite F
+GLIBC_2.27 __exp_finite F
+GLIBC_2.27 __expf_finite F
+GLIBC_2.27 __finite F
+GLIBC_2.27 __finitef F
+GLIBC_2.27 __fmod_finite F
+GLIBC_2.27 __fmodf_finite F
+GLIBC_2.27 __fpclassify F
+GLIBC_2.27 __fpclassifyf F
+GLIBC_2.27 __gamma_r_finite F
+GLIBC_2.27 __gammaf_r_finite F
+GLIBC_2.27 __hypot_finite F
+GLIBC_2.27 __hypotf_finite F
+GLIBC_2.27 __iseqsig F
+GLIBC_2.27 __iseqsigf F
+GLIBC_2.27 __issignaling F
+GLIBC_2.27 __issignalingf F
+GLIBC_2.27 __j0_finite F
+GLIBC_2.27 __j0f_finite F
+GLIBC_2.27 __j1_finite F
+GLIBC_2.27 __j1f_finite F
+GLIBC_2.27 __jn_finite F
+GLIBC_2.27 __jnf_finite F
+GLIBC_2.27 __lgamma_r_finite F
+GLIBC_2.27 __lgammaf_r_finite F
+GLIBC_2.27 __log10_finite F
+GLIBC_2.27 __log10f_finite F
+GLIBC_2.27 __log2_finite F
+GLIBC_2.27 __log2f_finite F
+GLIBC_2.27 __log_finite F
+GLIBC_2.27 __logf_finite F
+GLIBC_2.27 __pow_finite F
+GLIBC_2.27 __powf_finite F
+GLIBC_2.27 __remainder_finite F
+GLIBC_2.27 __remainderf_finite F
+GLIBC_2.27 __scalb_finite F
+GLIBC_2.27 __scalbf_finite F
+GLIBC_2.27 __signbit F
+GLIBC_2.27 __signbitf F
+GLIBC_2.27 __signgam D 0x4
+GLIBC_2.27 __sinh_finite F
+GLIBC_2.27 __sinhf_finite F
+GLIBC_2.27 __sqrt_finite F
+GLIBC_2.27 __sqrtf_finite F
+GLIBC_2.27 __y0_finite F
+GLIBC_2.27 __y0f_finite F
+GLIBC_2.27 __y1_finite F
+GLIBC_2.27 __y1f_finite F
+GLIBC_2.27 __yn_finite F
+GLIBC_2.27 __ynf_finite F
+GLIBC_2.27 acos F
+GLIBC_2.27 acosf F
+GLIBC_2.27 acosf32 F
+GLIBC_2.27 acosf32x F
+GLIBC_2.27 acosf64 F
+GLIBC_2.27 acosh F
+GLIBC_2.27 acoshf F
+GLIBC_2.27 acoshf32 F
+GLIBC_2.27 acoshf32x F
+GLIBC_2.27 acoshf64 F
+GLIBC_2.27 acoshl F
+GLIBC_2.27 acosl F
+GLIBC_2.27 asin F
+GLIBC_2.27 asinf F
+GLIBC_2.27 asinf32 F
+GLIBC_2.27 asinf32x F
+GLIBC_2.27 asinf64 F
+GLIBC_2.27 asinh F
+GLIBC_2.27 asinhf F
+GLIBC_2.27 asinhf32 F
+GLIBC_2.27 asinhf32x F
+GLIBC_2.27 asinhf64 F
+GLIBC_2.27 asinhl F
+GLIBC_2.27 asinl F
+GLIBC_2.27 atan F
+GLIBC_2.27 atan2 F
+GLIBC_2.27 atan2f F
+GLIBC_2.27 atan2f32 F
+GLIBC_2.27 atan2f32x F
+GLIBC_2.27 atan2f64 F
+GLIBC_2.27 atan2l F
+GLIBC_2.27 atanf F
+GLIBC_2.27 atanf32 F
+GLIBC_2.27 atanf32x F
+GLIBC_2.27 atanf64 F
+GLIBC_2.27 atanh F
+GLIBC_2.27 atanhf F
+GLIBC_2.27 atanhf32 F
+GLIBC_2.27 atanhf32x F
+GLIBC_2.27 atanhf64 F
+GLIBC_2.27 atanhl F
+GLIBC_2.27 atanl F
+GLIBC_2.27 cabs F
+GLIBC_2.27 cabsf F
+GLIBC_2.27 cabsf32 F
+GLIBC_2.27 cabsf32x F
+GLIBC_2.27 cabsf64 F
+GLIBC_2.27 cabsl F
+GLIBC_2.27 cacos F
+GLIBC_2.27 cacosf F
+GLIBC_2.27 cacosf32 F
+GLIBC_2.27 cacosf32x F
+GLIBC_2.27 cacosf64 F
+GLIBC_2.27 cacosh F
+GLIBC_2.27 cacoshf F
+GLIBC_2.27 cacoshf32 F
+GLIBC_2.27 cacoshf32x F
+GLIBC_2.27 cacoshf64 F
+GLIBC_2.27 cacoshl F
+GLIBC_2.27 cacosl F
+GLIBC_2.27 canonicalize F
+GLIBC_2.27 canonicalizef F
+GLIBC_2.27 canonicalizef32 F
+GLIBC_2.27 canonicalizef32x F
+GLIBC_2.27 canonicalizef64 F
+GLIBC_2.27 canonicalizel F
+GLIBC_2.27 carg F
+GLIBC_2.27 cargf F
+GLIBC_2.27 cargf32 F
+GLIBC_2.27 cargf32x F
+GLIBC_2.27 cargf64 F
+GLIBC_2.27 cargl F
+GLIBC_2.27 casin F
+GLIBC_2.27 casinf F
+GLIBC_2.27 casinf32 F
+GLIBC_2.27 casinf32x F
+GLIBC_2.27 casinf64 F
+GLIBC_2.27 casinh F
+GLIBC_2.27 casinhf F
+GLIBC_2.27 casinhf32 F
+GLIBC_2.27 casinhf32x F
+GLIBC_2.27 casinhf64 F
+GLIBC_2.27 casinhl F
+GLIBC_2.27 casinl F
+GLIBC_2.27 catan F
+GLIBC_2.27 catanf F
+GLIBC_2.27 catanf32 F
+GLIBC_2.27 catanf32x F
+GLIBC_2.27 catanf64 F
+GLIBC_2.27 catanh F
+GLIBC_2.27 catanhf F
+GLIBC_2.27 catanhf32 F
+GLIBC_2.27 catanhf32x F
+GLIBC_2.27 catanhf64 F
+GLIBC_2.27 catanhl F
+GLIBC_2.27 catanl F
+GLIBC_2.27 cbrt F
+GLIBC_2.27 cbrtf F
+GLIBC_2.27 cbrtf32 F
+GLIBC_2.27 cbrtf32x F
+GLIBC_2.27 cbrtf64 F
+GLIBC_2.27 cbrtl F
+GLIBC_2.27 ccos F
+GLIBC_2.27 ccosf F
+GLIBC_2.27 ccosf32 F
+GLIBC_2.27 ccosf32x F
+GLIBC_2.27 ccosf64 F
+GLIBC_2.27 ccosh F
+GLIBC_2.27 ccoshf F
+GLIBC_2.27 ccoshf32 F
+GLIBC_2.27 ccoshf32x F
+GLIBC_2.27 ccoshf64 F
+GLIBC_2.27 ccoshl F
+GLIBC_2.27 ccosl F
+GLIBC_2.27 ceil F
+GLIBC_2.27 ceilf F
+GLIBC_2.27 ceilf32 F
+GLIBC_2.27 ceilf32x F
+GLIBC_2.27 ceilf64 F
+GLIBC_2.27 ceill F
+GLIBC_2.27 cexp F
+GLIBC_2.27 cexpf F
+GLIBC_2.27 cexpf32 F
+GLIBC_2.27 cexpf32x F
+GLIBC_2.27 cexpf64 F
+GLIBC_2.27 cexpl F
+GLIBC_2.27 cimag F
+GLIBC_2.27 cimagf F
+GLIBC_2.27 cimagf32 F
+GLIBC_2.27 cimagf32x F
+GLIBC_2.27 cimagf64 F
+GLIBC_2.27 cimagl F
+GLIBC_2.27 clog F
+GLIBC_2.27 clog10 F
+GLIBC_2.27 clog10f F
+GLIBC_2.27 clog10f32 F
+GLIBC_2.27 clog10f32x F
+GLIBC_2.27 clog10f64 F
+GLIBC_2.27 clog10l F
+GLIBC_2.27 clogf F
+GLIBC_2.27 clogf32 F
+GLIBC_2.27 clogf32x F
+GLIBC_2.27 clogf64 F
+GLIBC_2.27 clogl F
+GLIBC_2.27 conj F
+GLIBC_2.27 conjf F
+GLIBC_2.27 conjf32 F
+GLIBC_2.27 conjf32x F
+GLIBC_2.27 conjf64 F
+GLIBC_2.27 conjl F
+GLIBC_2.27 copysign F
+GLIBC_2.27 copysignf F
+GLIBC_2.27 copysignf32 F
+GLIBC_2.27 copysignf32x F
+GLIBC_2.27 copysignf64 F
+GLIBC_2.27 copysignl F
+GLIBC_2.27 cos F
+GLIBC_2.27 cosf F
+GLIBC_2.27 cosf32 F
+GLIBC_2.27 cosf32x F
+GLIBC_2.27 cosf64 F
+GLIBC_2.27 cosh F
+GLIBC_2.27 coshf F
+GLIBC_2.27 coshf32 F
+GLIBC_2.27 coshf32x F
+GLIBC_2.27 coshf64 F
+GLIBC_2.27 coshl F
+GLIBC_2.27 cosl F
+GLIBC_2.27 cpow F
+GLIBC_2.27 cpowf F
+GLIBC_2.27 cpowf32 F
+GLIBC_2.27 cpowf32x F
+GLIBC_2.27 cpowf64 F
+GLIBC_2.27 cpowl F
+GLIBC_2.27 cproj F
+GLIBC_2.27 cprojf F
+GLIBC_2.27 cprojf32 F
+GLIBC_2.27 cprojf32x F
+GLIBC_2.27 cprojf64 F
+GLIBC_2.27 cprojl F
+GLIBC_2.27 creal F
+GLIBC_2.27 crealf F
+GLIBC_2.27 crealf32 F
+GLIBC_2.27 crealf32x F
+GLIBC_2.27 crealf64 F
+GLIBC_2.27 creall F
+GLIBC_2.27 csin F
+GLIBC_2.27 csinf F
+GLIBC_2.27 csinf32 F
+GLIBC_2.27 csinf32x F
+GLIBC_2.27 csinf64 F
+GLIBC_2.27 csinh F
+GLIBC_2.27 csinhf F
+GLIBC_2.27 csinhf32 F
+GLIBC_2.27 csinhf32x F
+GLIBC_2.27 csinhf64 F
+GLIBC_2.27 csinhl F
+GLIBC_2.27 csinl F
+GLIBC_2.27 csqrt F
+GLIBC_2.27 csqrtf F
+GLIBC_2.27 csqrtf32 F
+GLIBC_2.27 csqrtf32x F
+GLIBC_2.27 csqrtf64 F
+GLIBC_2.27 csqrtl F
+GLIBC_2.27 ctan F
+GLIBC_2.27 ctanf F
+GLIBC_2.27 ctanf32 F
+GLIBC_2.27 ctanf32x F
+GLIBC_2.27 ctanf64 F
+GLIBC_2.27 ctanh F
+GLIBC_2.27 ctanhf F
+GLIBC_2.27 ctanhf32 F
+GLIBC_2.27 ctanhf32x F
+GLIBC_2.27 ctanhf64 F
+GLIBC_2.27 ctanhl F
+GLIBC_2.27 ctanl F
+GLIBC_2.27 drem F
+GLIBC_2.27 dremf F
+GLIBC_2.27 dreml F
+GLIBC_2.27 erf F
+GLIBC_2.27 erfc F
+GLIBC_2.27 erfcf F
+GLIBC_2.27 erfcf32 F
+GLIBC_2.27 erfcf32x F
+GLIBC_2.27 erfcf64 F
+GLIBC_2.27 erfcl F
+GLIBC_2.27 erff F
+GLIBC_2.27 erff32 F
+GLIBC_2.27 erff32x F
+GLIBC_2.27 erff64 F
+GLIBC_2.27 erfl F
+GLIBC_2.27 exp F
+GLIBC_2.27 exp10 F
+GLIBC_2.27 exp10f F
+GLIBC_2.27 exp10f32 F
+GLIBC_2.27 exp10f32x F
+GLIBC_2.27 exp10f64 F
+GLIBC_2.27 exp10l F
+GLIBC_2.27 exp2 F
+GLIBC_2.27 exp2f F
+GLIBC_2.27 exp2f32 F
+GLIBC_2.27 exp2f32x F
+GLIBC_2.27 exp2f64 F
+GLIBC_2.27 exp2l F
+GLIBC_2.27 expf F
+GLIBC_2.27 expf32 F
+GLIBC_2.27 expf32x F
+GLIBC_2.27 expf64 F
+GLIBC_2.27 expl F
+GLIBC_2.27 expm1 F
+GLIBC_2.27 expm1f F
+GLIBC_2.27 expm1f32 F
+GLIBC_2.27 expm1f32x F
+GLIBC_2.27 expm1f64 F
+GLIBC_2.27 expm1l F
+GLIBC_2.27 fabs F
+GLIBC_2.27 fabsf F
+GLIBC_2.27 fabsf32 F
+GLIBC_2.27 fabsf32x F
+GLIBC_2.27 fabsf64 F
+GLIBC_2.27 fabsl F
+GLIBC_2.27 fdim F
+GLIBC_2.27 fdimf F
+GLIBC_2.27 fdimf32 F
+GLIBC_2.27 fdimf32x F
+GLIBC_2.27 fdimf64 F
+GLIBC_2.27 fdiml F
+GLIBC_2.27 feclearexcept F
+GLIBC_2.27 fedisableexcept F
+GLIBC_2.27 feenableexcept F
+GLIBC_2.27 fegetenv F
+GLIBC_2.27 fegetexcept F
+GLIBC_2.27 fegetexceptflag F
+GLIBC_2.27 fegetmode F
+GLIBC_2.27 fegetround F
+GLIBC_2.27 feholdexcept F
+GLIBC_2.27 feraiseexcept F
+GLIBC_2.27 fesetenv F
+GLIBC_2.27 fesetexcept F
+GLIBC_2.27 fesetexceptflag F
+GLIBC_2.27 fesetmode F
+GLIBC_2.27 fesetround F
+GLIBC_2.27 fetestexcept F
+GLIBC_2.27 fetestexceptflag F
+GLIBC_2.27 feupdateenv F
+GLIBC_2.27 finite F
+GLIBC_2.27 finitef F
+GLIBC_2.27 finitel F
+GLIBC_2.27 floor F
+GLIBC_2.27 floorf F
+GLIBC_2.27 floorf32 F
+GLIBC_2.27 floorf32x F
+GLIBC_2.27 floorf64 F
+GLIBC_2.27 floorl F
+GLIBC_2.27 fma F
+GLIBC_2.27 fmaf F
+GLIBC_2.27 fmaf32 F
+GLIBC_2.27 fmaf32x F
+GLIBC_2.27 fmaf64 F
+GLIBC_2.27 fmal F
+GLIBC_2.27 fmax F
+GLIBC_2.27 fmaxf F
+GLIBC_2.27 fmaxf32 F
+GLIBC_2.27 fmaxf32x F
+GLIBC_2.27 fmaxf64 F
+GLIBC_2.27 fmaxl F
+GLIBC_2.27 fmaxmag F
+GLIBC_2.27 fmaxmagf F
+GLIBC_2.27 fmaxmagf32 F
+GLIBC_2.27 fmaxmagf32x F
+GLIBC_2.27 fmaxmagf64 F
+GLIBC_2.27 fmaxmagl F
+GLIBC_2.27 fmin F
+GLIBC_2.27 fminf F
+GLIBC_2.27 fminf32 F
+GLIBC_2.27 fminf32x F
+GLIBC_2.27 fminf64 F
+GLIBC_2.27 fminl F
+GLIBC_2.27 fminmag F
+GLIBC_2.27 fminmagf F
+GLIBC_2.27 fminmagf32 F
+GLIBC_2.27 fminmagf32x F
+GLIBC_2.27 fminmagf64 F
+GLIBC_2.27 fminmagl F
+GLIBC_2.27 fmod F
+GLIBC_2.27 fmodf F
+GLIBC_2.27 fmodf32 F
+GLIBC_2.27 fmodf32x F
+GLIBC_2.27 fmodf64 F
+GLIBC_2.27 fmodl F
+GLIBC_2.27 frexp F
+GLIBC_2.27 frexpf F
+GLIBC_2.27 frexpf32 F
+GLIBC_2.27 frexpf32x F
+GLIBC_2.27 frexpf64 F
+GLIBC_2.27 frexpl F
+GLIBC_2.27 fromfp F
+GLIBC_2.27 fromfpf F
+GLIBC_2.27 fromfpf32 F
+GLIBC_2.27 fromfpf32x F
+GLIBC_2.27 fromfpf64 F
+GLIBC_2.27 fromfpl F
+GLIBC_2.27 fromfpx F
+GLIBC_2.27 fromfpxf F
+GLIBC_2.27 fromfpxf32 F
+GLIBC_2.27 fromfpxf32x F
+GLIBC_2.27 fromfpxf64 F
+GLIBC_2.27 fromfpxl F
+GLIBC_2.27 gamma F
+GLIBC_2.27 gammaf F
+GLIBC_2.27 gammal F
+GLIBC_2.27 getpayload F
+GLIBC_2.27 getpayloadf F
+GLIBC_2.27 getpayloadf32 F
+GLIBC_2.27 getpayloadf32x F
+GLIBC_2.27 getpayloadf64 F
+GLIBC_2.27 getpayloadl F
+GLIBC_2.27 hypot F
+GLIBC_2.27 hypotf F
+GLIBC_2.27 hypotf32 F
+GLIBC_2.27 hypotf32x F
+GLIBC_2.27 hypotf64 F
+GLIBC_2.27 hypotl F
+GLIBC_2.27 ilogb F
+GLIBC_2.27 ilogbf F
+GLIBC_2.27 ilogbf32 F
+GLIBC_2.27 ilogbf32x F
+GLIBC_2.27 ilogbf64 F
+GLIBC_2.27 ilogbl F
+GLIBC_2.27 j0 F
+GLIBC_2.27 j0f F
+GLIBC_2.27 j0f32 F
+GLIBC_2.27 j0f32x F
+GLIBC_2.27 j0f64 F
+GLIBC_2.27 j0l F
+GLIBC_2.27 j1 F
+GLIBC_2.27 j1f F
+GLIBC_2.27 j1f32 F
+GLIBC_2.27 j1f32x F
+GLIBC_2.27 j1f64 F
+GLIBC_2.27 j1l F
+GLIBC_2.27 jn F
+GLIBC_2.27 jnf F
+GLIBC_2.27 jnf32 F
+GLIBC_2.27 jnf32x F
+GLIBC_2.27 jnf64 F
+GLIBC_2.27 jnl F
+GLIBC_2.27 ldexp F
+GLIBC_2.27 ldexpf F
+GLIBC_2.27 ldexpf32 F
+GLIBC_2.27 ldexpf32x F
+GLIBC_2.27 ldexpf64 F
+GLIBC_2.27 ldexpl F
+GLIBC_2.27 lgamma F
+GLIBC_2.27 lgamma_r F
+GLIBC_2.27 lgammaf F
+GLIBC_2.27 lgammaf32 F
+GLIBC_2.27 lgammaf32_r F
+GLIBC_2.27 lgammaf32x F
+GLIBC_2.27 lgammaf32x_r F
+GLIBC_2.27 lgammaf64 F
+GLIBC_2.27 lgammaf64_r F
+GLIBC_2.27 lgammaf_r F
+GLIBC_2.27 lgammal F
+GLIBC_2.27 lgammal_r F
+GLIBC_2.27 llogb F
+GLIBC_2.27 llogbf F
+GLIBC_2.27 llogbf32 F
+GLIBC_2.27 llogbf32x F
+GLIBC_2.27 llogbf64 F
+GLIBC_2.27 llogbl F
+GLIBC_2.27 llrint F
+GLIBC_2.27 llrintf F
+GLIBC_2.27 llrintf32 F
+GLIBC_2.27 llrintf32x F
+GLIBC_2.27 llrintf64 F
+GLIBC_2.27 llrintl F
+GLIBC_2.27 llround F
+GLIBC_2.27 llroundf F
+GLIBC_2.27 llroundf32 F
+GLIBC_2.27 llroundf32x F
+GLIBC_2.27 llroundf64 F
+GLIBC_2.27 llroundl F
+GLIBC_2.27 log F
+GLIBC_2.27 log10 F
+GLIBC_2.27 log10f F
+GLIBC_2.27 log10f32 F
+GLIBC_2.27 log10f32x F
+GLIBC_2.27 log10f64 F
+GLIBC_2.27 log10l F
+GLIBC_2.27 log1p F
+GLIBC_2.27 log1pf F
+GLIBC_2.27 log1pf32 F
+GLIBC_2.27 log1pf32x F
+GLIBC_2.27 log1pf64 F
+GLIBC_2.27 log1pl F
+GLIBC_2.27 log2 F
+GLIBC_2.27 log2f F
+GLIBC_2.27 log2f32 F
+GLIBC_2.27 log2f32x F
+GLIBC_2.27 log2f64 F
+GLIBC_2.27 log2l F
+GLIBC_2.27 logb F
+GLIBC_2.27 logbf F
+GLIBC_2.27 logbf32 F
+GLIBC_2.27 logbf32x F
+GLIBC_2.27 logbf64 F
+GLIBC_2.27 logbl F
+GLIBC_2.27 logf F
+GLIBC_2.27 logf32 F
+GLIBC_2.27 logf32x F
+GLIBC_2.27 logf64 F
+GLIBC_2.27 logl F
+GLIBC_2.27 lrint F
+GLIBC_2.27 lrintf F
+GLIBC_2.27 lrintf32 F
+GLIBC_2.27 lrintf32x F
+GLIBC_2.27 lrintf64 F
+GLIBC_2.27 lrintl F
+GLIBC_2.27 lround F
+GLIBC_2.27 lroundf F
+GLIBC_2.27 lroundf32 F
+GLIBC_2.27 lroundf32x F
+GLIBC_2.27 lroundf64 F
+GLIBC_2.27 lroundl F
+GLIBC_2.27 modf F
+GLIBC_2.27 modff F
+GLIBC_2.27 modff32 F
+GLIBC_2.27 modff32x F
+GLIBC_2.27 modff64 F
+GLIBC_2.27 modfl F
+GLIBC_2.27 nan F
+GLIBC_2.27 nanf F
+GLIBC_2.27 nanf32 F
+GLIBC_2.27 nanf32x F
+GLIBC_2.27 nanf64 F
+GLIBC_2.27 nanl F
+GLIBC_2.27 nearbyint F
+GLIBC_2.27 nearbyintf F
+GLIBC_2.27 nearbyintf32 F
+GLIBC_2.27 nearbyintf32x F
+GLIBC_2.27 nearbyintf64 F
+GLIBC_2.27 nearbyintl F
+GLIBC_2.27 nextafter F
+GLIBC_2.27 nextafterf F
+GLIBC_2.27 nextafterf32 F
+GLIBC_2.27 nextafterf32x F
+GLIBC_2.27 nextafterf64 F
+GLIBC_2.27 nextafterl F
+GLIBC_2.27 nextdown F
+GLIBC_2.27 nextdownf F
+GLIBC_2.27 nextdownf32 F
+GLIBC_2.27 nextdownf32x F
+GLIBC_2.27 nextdownf64 F
+GLIBC_2.27 nextdownl F
+GLIBC_2.27 nexttoward F
+GLIBC_2.27 nexttowardf F
+GLIBC_2.27 nexttowardl F
+GLIBC_2.27 nextup F
+GLIBC_2.27 nextupf F
+GLIBC_2.27 nextupf32 F
+GLIBC_2.27 nextupf32x F
+GLIBC_2.27 nextupf64 F
+GLIBC_2.27 nextupl F
+GLIBC_2.27 pow F
+GLIBC_2.27 powf F
+GLIBC_2.27 powf32 F
+GLIBC_2.27 powf32x F
+GLIBC_2.27 powf64 F
+GLIBC_2.27 powl F
+GLIBC_2.27 remainder F
+GLIBC_2.27 remainderf F
+GLIBC_2.27 remainderf32 F
+GLIBC_2.27 remainderf32x F
+GLIBC_2.27 remainderf64 F
+GLIBC_2.27 remainderl F
+GLIBC_2.27 remquo F
+GLIBC_2.27 remquof F
+GLIBC_2.27 remquof32 F
+GLIBC_2.27 remquof32x F
+GLIBC_2.27 remquof64 F
+GLIBC_2.27 remquol F
+GLIBC_2.27 rint F
+GLIBC_2.27 rintf F
+GLIBC_2.27 rintf32 F
+GLIBC_2.27 rintf32x F
+GLIBC_2.27 rintf64 F
+GLIBC_2.27 rintl F
+GLIBC_2.27 round F
+GLIBC_2.27 roundeven F
+GLIBC_2.27 roundevenf F
+GLIBC_2.27 roundevenf32 F
+GLIBC_2.27 roundevenf32x F
+GLIBC_2.27 roundevenf64 F
+GLIBC_2.27 roundevenl F
+GLIBC_2.27 roundf F
+GLIBC_2.27 roundf32 F
+GLIBC_2.27 roundf32x F
+GLIBC_2.27 roundf64 F
+GLIBC_2.27 roundl F
+GLIBC_2.27 scalb F
+GLIBC_2.27 scalbf F
+GLIBC_2.27 scalbl F
+GLIBC_2.27 scalbln F
+GLIBC_2.27 scalblnf F
+GLIBC_2.27 scalblnf32 F
+GLIBC_2.27 scalblnf32x F
+GLIBC_2.27 scalblnf64 F
+GLIBC_2.27 scalblnl F
+GLIBC_2.27 scalbn F
+GLIBC_2.27 scalbnf F
+GLIBC_2.27 scalbnf32 F
+GLIBC_2.27 scalbnf32x F
+GLIBC_2.27 scalbnf64 F
+GLIBC_2.27 scalbnl F
+GLIBC_2.27 setpayload F
+GLIBC_2.27 setpayloadf F
+GLIBC_2.27 setpayloadf32 F
+GLIBC_2.27 setpayloadf32x F
+GLIBC_2.27 setpayloadf64 F
+GLIBC_2.27 setpayloadl F
+GLIBC_2.27 setpayloadsig F
+GLIBC_2.27 setpayloadsigf F
+GLIBC_2.27 setpayloadsigf32 F
+GLIBC_2.27 setpayloadsigf32x F
+GLIBC_2.27 setpayloadsigf64 F
+GLIBC_2.27 setpayloadsigl F
+GLIBC_2.27 signgam D 0x4
+GLIBC_2.27 significand F
+GLIBC_2.27 significandf F
+GLIBC_2.27 significandl F
+GLIBC_2.27 sin F
+GLIBC_2.27 sincos F
+GLIBC_2.27 sincosf F
+GLIBC_2.27 sincosf32 F
+GLIBC_2.27 sincosf32x F
+GLIBC_2.27 sincosf64 F
+GLIBC_2.27 sincosl F
+GLIBC_2.27 sinf F
+GLIBC_2.27 sinf32 F
+GLIBC_2.27 sinf32x F
+GLIBC_2.27 sinf64 F
+GLIBC_2.27 sinh F
+GLIBC_2.27 sinhf F
+GLIBC_2.27 sinhf32 F
+GLIBC_2.27 sinhf32x F
+GLIBC_2.27 sinhf64 F
+GLIBC_2.27 sinhl F
+GLIBC_2.27 sinl F
+GLIBC_2.27 sqrt F
+GLIBC_2.27 sqrtf F
+GLIBC_2.27 sqrtf32 F
+GLIBC_2.27 sqrtf32x F
+GLIBC_2.27 sqrtf64 F
+GLIBC_2.27 sqrtl F
+GLIBC_2.27 tan F
+GLIBC_2.27 tanf F
+GLIBC_2.27 tanf32 F
+GLIBC_2.27 tanf32x F
+GLIBC_2.27 tanf64 F
+GLIBC_2.27 tanh F
+GLIBC_2.27 tanhf F
+GLIBC_2.27 tanhf32 F
+GLIBC_2.27 tanhf32x F
+GLIBC_2.27 tanhf64 F
+GLIBC_2.27 tanhl F
+GLIBC_2.27 tanl F
+GLIBC_2.27 tgamma F
+GLIBC_2.27 tgammaf F
+GLIBC_2.27 tgammaf32 F
+GLIBC_2.27 tgammaf32x F
+GLIBC_2.27 tgammaf64 F
+GLIBC_2.27 tgammal F
+GLIBC_2.27 totalorder F
+GLIBC_2.27 totalorderf F
+GLIBC_2.27 totalorderf32 F
+GLIBC_2.27 totalorderf32x F
+GLIBC_2.27 totalorderf64 F
+GLIBC_2.27 totalorderl F
+GLIBC_2.27 totalordermag F
+GLIBC_2.27 totalordermagf F
+GLIBC_2.27 totalordermagf32 F
+GLIBC_2.27 totalordermagf32x F
+GLIBC_2.27 totalordermagf64 F
+GLIBC_2.27 totalordermagl F
+GLIBC_2.27 trunc F
+GLIBC_2.27 truncf F
+GLIBC_2.27 truncf32 F
+GLIBC_2.27 truncf32x F
+GLIBC_2.27 truncf64 F
+GLIBC_2.27 truncl F
+GLIBC_2.27 ufromfp F
+GLIBC_2.27 ufromfpf F
+GLIBC_2.27 ufromfpf32 F
+GLIBC_2.27 ufromfpf32x F
+GLIBC_2.27 ufromfpf64 F
+GLIBC_2.27 ufromfpl F
+GLIBC_2.27 ufromfpx F
+GLIBC_2.27 ufromfpxf F
+GLIBC_2.27 ufromfpxf32 F
+GLIBC_2.27 ufromfpxf32x F
+GLIBC_2.27 ufromfpxf64 F
+GLIBC_2.27 ufromfpxl F
+GLIBC_2.27 y0 F
+GLIBC_2.27 y0f F
+GLIBC_2.27 y0f32 F
+GLIBC_2.27 y0f32x F
+GLIBC_2.27 y0f64 F
+GLIBC_2.27 y0l F
+GLIBC_2.27 y1 F
+GLIBC_2.27 y1f F
+GLIBC_2.27 y1f32 F
+GLIBC_2.27 y1f32x F
+GLIBC_2.27 y1f64 F
+GLIBC_2.27 y1l F
+GLIBC_2.27 yn F
+GLIBC_2.27 ynf F
+GLIBC_2.27 ynf32 F
+GLIBC_2.27 ynf32x F
+GLIBC_2.27 ynf64 F
+GLIBC_2.27 ynl F
+GLIBC_2.28 GLIBC_2.28 A
+GLIBC_2.28 daddl F
+GLIBC_2.28 f32addf32x F
+GLIBC_2.28 f32addf64 F
+GLIBC_2.28 f32xaddf64 F
+GLIBC_2.28 fadd F
+GLIBC_2.28 faddl F
diff --git a/sysdeps/unix/sysv/linux/csky/libnsl.abilist b/sysdeps/unix/sysv/linux/csky/libnsl.abilist
new file mode 100644
index 0000000..b7a0f82
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libnsl.abilist
@@ -0,0 +1,121 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 __free_fdresult F
+GLIBC_2.27 __nis_default_access F
+GLIBC_2.27 __nis_default_group F
+GLIBC_2.27 __nis_default_owner F
+GLIBC_2.27 __nis_default_ttl F
+GLIBC_2.27 __nis_finddirectory F
+GLIBC_2.27 __nisbind_connect F
+GLIBC_2.27 __nisbind_create F
+GLIBC_2.27 __nisbind_destroy F
+GLIBC_2.27 __nisbind_next F
+GLIBC_2.27 __yp_check F
+GLIBC_2.27 nis_add F
+GLIBC_2.27 nis_add_entry F
+GLIBC_2.27 nis_addmember F
+GLIBC_2.27 nis_checkpoint F
+GLIBC_2.27 nis_clone_directory F
+GLIBC_2.27 nis_clone_object F
+GLIBC_2.27 nis_clone_result F
+GLIBC_2.27 nis_creategroup F
+GLIBC_2.27 nis_destroy_object F
+GLIBC_2.27 nis_destroygroup F
+GLIBC_2.27 nis_dir_cmp F
+GLIBC_2.27 nis_domain_of F
+GLIBC_2.27 nis_domain_of_r F
+GLIBC_2.27 nis_first_entry F
+GLIBC_2.27 nis_free_directory F
+GLIBC_2.27 nis_free_object F
+GLIBC_2.27 nis_free_request F
+GLIBC_2.27 nis_freenames F
+GLIBC_2.27 nis_freeresult F
+GLIBC_2.27 nis_freeservlist F
+GLIBC_2.27 nis_freetags F
+GLIBC_2.27 nis_getnames F
+GLIBC_2.27 nis_getservlist F
+GLIBC_2.27 nis_ismember F
+GLIBC_2.27 nis_leaf_of F
+GLIBC_2.27 nis_leaf_of_r F
+GLIBC_2.27 nis_lerror F
+GLIBC_2.27 nis_list F
+GLIBC_2.27 nis_local_directory F
+GLIBC_2.27 nis_local_group F
+GLIBC_2.27 nis_local_host F
+GLIBC_2.27 nis_local_principal F
+GLIBC_2.27 nis_lookup F
+GLIBC_2.27 nis_mkdir F
+GLIBC_2.27 nis_modify F
+GLIBC_2.27 nis_modify_entry F
+GLIBC_2.27 nis_name_of F
+GLIBC_2.27 nis_name_of_r F
+GLIBC_2.27 nis_next_entry F
+GLIBC_2.27 nis_perror F
+GLIBC_2.27 nis_ping F
+GLIBC_2.27 nis_print_directory F
+GLIBC_2.27 nis_print_entry F
+GLIBC_2.27 nis_print_group F
+GLIBC_2.27 nis_print_group_entry F
+GLIBC_2.27 nis_print_link F
+GLIBC_2.27 nis_print_object F
+GLIBC_2.27 nis_print_result F
+GLIBC_2.27 nis_print_rights F
+GLIBC_2.27 nis_print_table F
+GLIBC_2.27 nis_read_obj F
+GLIBC_2.27 nis_remove F
+GLIBC_2.27 nis_remove_entry F
+GLIBC_2.27 nis_removemember F
+GLIBC_2.27 nis_rmdir F
+GLIBC_2.27 nis_servstate F
+GLIBC_2.27 nis_sperrno F
+GLIBC_2.27 nis_sperror F
+GLIBC_2.27 nis_sperror_r F
+GLIBC_2.27 nis_stats F
+GLIBC_2.27 nis_verifygroup F
+GLIBC_2.27 nis_write_obj F
+GLIBC_2.27 readColdStartFile F
+GLIBC_2.27 writeColdStartFile F
+GLIBC_2.27 xdr_cback_data F
+GLIBC_2.27 xdr_domainname F
+GLIBC_2.27 xdr_keydat F
+GLIBC_2.27 xdr_mapname F
+GLIBC_2.27 xdr_obj_p F
+GLIBC_2.27 xdr_peername F
+GLIBC_2.27 xdr_valdat F
+GLIBC_2.27 xdr_yp_buf F
+GLIBC_2.27 xdr_ypall F
+GLIBC_2.27 xdr_ypbind_binding F
+GLIBC_2.27 xdr_ypbind_resp F
+GLIBC_2.27 xdr_ypbind_resptype F
+GLIBC_2.27 xdr_ypbind_setdom F
+GLIBC_2.27 xdr_ypdelete_args F
+GLIBC_2.27 xdr_ypmap_parms F
+GLIBC_2.27 xdr_ypmaplist F
+GLIBC_2.27 xdr_yppush_status F
+GLIBC_2.27 xdr_yppushresp_xfr F
+GLIBC_2.27 xdr_ypreq_key F
+GLIBC_2.27 xdr_ypreq_nokey F
+GLIBC_2.27 xdr_ypreq_xfr F
+GLIBC_2.27 xdr_ypresp_all F
+GLIBC_2.27 xdr_ypresp_key_val F
+GLIBC_2.27 xdr_ypresp_maplist F
+GLIBC_2.27 xdr_ypresp_master F
+GLIBC_2.27 xdr_ypresp_order F
+GLIBC_2.27 xdr_ypresp_val F
+GLIBC_2.27 xdr_ypresp_xfr F
+GLIBC_2.27 xdr_ypstat F
+GLIBC_2.27 xdr_ypupdate_args F
+GLIBC_2.27 xdr_ypxfrstat F
+GLIBC_2.27 yp_all F
+GLIBC_2.27 yp_bind F
+GLIBC_2.27 yp_first F
+GLIBC_2.27 yp_get_default_domain F
+GLIBC_2.27 yp_maplist F
+GLIBC_2.27 yp_master F
+GLIBC_2.27 yp_match F
+GLIBC_2.27 yp_next F
+GLIBC_2.27 yp_order F
+GLIBC_2.27 yp_unbind F
+GLIBC_2.27 yp_update F
+GLIBC_2.27 ypbinderr_string F
+GLIBC_2.27 yperr_string F
+GLIBC_2.27 ypprot_err F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
new file mode 100644
index 0000000..fcc14ed
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -0,0 +1,217 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 _IO_flockfile F
+GLIBC_2.27 _IO_ftrylockfile F
+GLIBC_2.27 _IO_funlockfile F
+GLIBC_2.27 __close F
+GLIBC_2.27 __connect F
+GLIBC_2.27 __errno_location F
+GLIBC_2.27 __fcntl F
+GLIBC_2.27 __h_errno_location F
+GLIBC_2.27 __libc_allocate_rtsig F
+GLIBC_2.27 __libc_current_sigrtmax F
+GLIBC_2.27 __libc_current_sigrtmin F
+GLIBC_2.27 __lseek F
+GLIBC_2.27 __nanosleep F
+GLIBC_2.27 __open F
+GLIBC_2.27 __open64 F
+GLIBC_2.27 __pread64 F
+GLIBC_2.27 __pthread_cleanup_routine F
+GLIBC_2.27 __pthread_getspecific F
+GLIBC_2.27 __pthread_key_create F
+GLIBC_2.27 __pthread_mutex_destroy F
+GLIBC_2.27 __pthread_mutex_init F
+GLIBC_2.27 __pthread_mutex_lock F
+GLIBC_2.27 __pthread_mutex_trylock F
+GLIBC_2.27 __pthread_mutex_unlock F
+GLIBC_2.27 __pthread_mutexattr_destroy F
+GLIBC_2.27 __pthread_mutexattr_init F
+GLIBC_2.27 __pthread_mutexattr_settype F
+GLIBC_2.27 __pthread_once F
+GLIBC_2.27 __pthread_register_cancel F
+GLIBC_2.27 __pthread_register_cancel_defer F
+GLIBC_2.27 __pthread_rwlock_destroy F
+GLIBC_2.27 __pthread_rwlock_init F
+GLIBC_2.27 __pthread_rwlock_rdlock F
+GLIBC_2.27 __pthread_rwlock_tryrdlock F
+GLIBC_2.27 __pthread_rwlock_trywrlock F
+GLIBC_2.27 __pthread_rwlock_unlock F
+GLIBC_2.27 __pthread_rwlock_wrlock F
+GLIBC_2.27 __pthread_setspecific F
+GLIBC_2.27 __pthread_unregister_cancel F
+GLIBC_2.27 __pthread_unregister_cancel_restore F
+GLIBC_2.27 __pthread_unwind_next F
+GLIBC_2.27 __pwrite64 F
+GLIBC_2.27 __read F
+GLIBC_2.27 __res_state F
+GLIBC_2.27 __send F
+GLIBC_2.27 __sigaction F
+GLIBC_2.27 __wait F
+GLIBC_2.27 __write F
+GLIBC_2.27 _pthread_cleanup_pop F
+GLIBC_2.27 _pthread_cleanup_pop_restore F
+GLIBC_2.27 _pthread_cleanup_push F
+GLIBC_2.27 _pthread_cleanup_push_defer F
+GLIBC_2.27 accept F
+GLIBC_2.27 close F
+GLIBC_2.27 connect F
+GLIBC_2.27 fcntl F
+GLIBC_2.27 flockfile F
+GLIBC_2.27 fsync F
+GLIBC_2.27 ftrylockfile F
+GLIBC_2.27 funlockfile F
+GLIBC_2.27 lseek F
+GLIBC_2.27 lseek64 F
+GLIBC_2.27 msync F
+GLIBC_2.27 nanosleep F
+GLIBC_2.27 open F
+GLIBC_2.27 open64 F
+GLIBC_2.27 pause F
+GLIBC_2.27 pread F
+GLIBC_2.27 pread64 F
+GLIBC_2.27 pthread_attr_destroy F
+GLIBC_2.27 pthread_attr_getaffinity_np F
+GLIBC_2.27 pthread_attr_getdetachstate F
+GLIBC_2.27 pthread_attr_getguardsize F
+GLIBC_2.27 pthread_attr_getinheritsched F
+GLIBC_2.27 pthread_attr_getschedparam F
+GLIBC_2.27 pthread_attr_getschedpolicy F
+GLIBC_2.27 pthread_attr_getscope F
+GLIBC_2.27 pthread_attr_getstack F
+GLIBC_2.27 pthread_attr_getstackaddr F
+GLIBC_2.27 pthread_attr_getstacksize F
+GLIBC_2.27 pthread_attr_init F
+GLIBC_2.27 pthread_attr_setaffinity_np F
+GLIBC_2.27 pthread_attr_setdetachstate F
+GLIBC_2.27 pthread_attr_setguardsize F
+GLIBC_2.27 pthread_attr_setinheritsched F
+GLIBC_2.27 pthread_attr_setschedparam F
+GLIBC_2.27 pthread_attr_setschedpolicy F
+GLIBC_2.27 pthread_attr_setscope F
+GLIBC_2.27 pthread_attr_setstack F
+GLIBC_2.27 pthread_attr_setstackaddr F
+GLIBC_2.27 pthread_attr_setstacksize F
+GLIBC_2.27 pthread_barrier_destroy F
+GLIBC_2.27 pthread_barrier_init F
+GLIBC_2.27 pthread_barrier_wait F
+GLIBC_2.27 pthread_barrierattr_destroy F
+GLIBC_2.27 pthread_barrierattr_getpshared F
+GLIBC_2.27 pthread_barrierattr_init F
+GLIBC_2.27 pthread_barrierattr_setpshared F
+GLIBC_2.27 pthread_cancel F
+GLIBC_2.27 pthread_cond_broadcast F
+GLIBC_2.27 pthread_cond_destroy F
+GLIBC_2.27 pthread_cond_init F
+GLIBC_2.27 pthread_cond_signal F
+GLIBC_2.27 pthread_cond_timedwait F
+GLIBC_2.27 pthread_cond_wait F
+GLIBC_2.27 pthread_condattr_destroy F
+GLIBC_2.27 pthread_condattr_getclock F
+GLIBC_2.27 pthread_condattr_getpshared F
+GLIBC_2.27 pthread_condattr_init F
+GLIBC_2.27 pthread_condattr_setclock F
+GLIBC_2.27 pthread_condattr_setpshared F
+GLIBC_2.27 pthread_create F
+GLIBC_2.27 pthread_detach F
+GLIBC_2.27 pthread_equal F
+GLIBC_2.27 pthread_exit F
+GLIBC_2.27 pthread_getaffinity_np F
+GLIBC_2.27 pthread_getattr_default_np F
+GLIBC_2.27 pthread_getattr_np F
+GLIBC_2.27 pthread_getconcurrency F
+GLIBC_2.27 pthread_getcpuclockid F
+GLIBC_2.27 pthread_getname_np F
+GLIBC_2.27 pthread_getschedparam F
+GLIBC_2.27 pthread_getspecific F
+GLIBC_2.27 pthread_join F
+GLIBC_2.27 pthread_key_create F
+GLIBC_2.27 pthread_key_delete F
+GLIBC_2.27 pthread_kill F
+GLIBC_2.27 pthread_kill_other_threads_np F
+GLIBC_2.27 pthread_mutex_consistent F
+GLIBC_2.27 pthread_mutex_consistent_np F
+GLIBC_2.27 pthread_mutex_destroy F
+GLIBC_2.27 pthread_mutex_getprioceiling F
+GLIBC_2.27 pthread_mutex_init F
+GLIBC_2.27 pthread_mutex_lock F
+GLIBC_2.27 pthread_mutex_setprioceiling F
+GLIBC_2.27 pthread_mutex_timedlock F
+GLIBC_2.27 pthread_mutex_trylock F
+GLIBC_2.27 pthread_mutex_unlock F
+GLIBC_2.27 pthread_mutexattr_destroy F
+GLIBC_2.27 pthread_mutexattr_getkind_np F
+GLIBC_2.27 pthread_mutexattr_getprioceiling F
+GLIBC_2.27 pthread_mutexattr_getprotocol F
+GLIBC_2.27 pthread_mutexattr_getpshared F
+GLIBC_2.27 pthread_mutexattr_getrobust F
+GLIBC_2.27 pthread_mutexattr_getrobust_np F
+GLIBC_2.27 pthread_mutexattr_gettype F
+GLIBC_2.27 pthread_mutexattr_init F
+GLIBC_2.27 pthread_mutexattr_setkind_np F
+GLIBC_2.27 pthread_mutexattr_setprioceiling F
+GLIBC_2.27 pthread_mutexattr_setprotocol F
+GLIBC_2.27 pthread_mutexattr_setpshared F
+GLIBC_2.27 pthread_mutexattr_setrobust F
+GLIBC_2.27 pthread_mutexattr_setrobust_np F
+GLIBC_2.27 pthread_mutexattr_settype F
+GLIBC_2.27 pthread_once F
+GLIBC_2.27 pthread_rwlock_destroy F
+GLIBC_2.27 pthread_rwlock_init F
+GLIBC_2.27 pthread_rwlock_rdlock F
+GLIBC_2.27 pthread_rwlock_timedrdlock F
+GLIBC_2.27 pthread_rwlock_timedwrlock F
+GLIBC_2.27 pthread_rwlock_tryrdlock F
+GLIBC_2.27 pthread_rwlock_trywrlock F
+GLIBC_2.27 pthread_rwlock_unlock F
+GLIBC_2.27 pthread_rwlock_wrlock F
+GLIBC_2.27 pthread_rwlockattr_destroy F
+GLIBC_2.27 pthread_rwlockattr_getkind_np F
+GLIBC_2.27 pthread_rwlockattr_getpshared F
+GLIBC_2.27 pthread_rwlockattr_init F
+GLIBC_2.27 pthread_rwlockattr_setkind_np F
+GLIBC_2.27 pthread_rwlockattr_setpshared F
+GLIBC_2.27 pthread_setaffinity_np F
+GLIBC_2.27 pthread_setattr_default_np F
+GLIBC_2.27 pthread_setcancelstate F
+GLIBC_2.27 pthread_setcanceltype F
+GLIBC_2.27 pthread_setconcurrency F
+GLIBC_2.27 pthread_setname_np F
+GLIBC_2.27 pthread_setschedparam F
+GLIBC_2.27 pthread_setschedprio F
+GLIBC_2.27 pthread_setspecific F
+GLIBC_2.27 pthread_sigmask F
+GLIBC_2.27 pthread_sigqueue F
+GLIBC_2.27 pthread_spin_destroy F
+GLIBC_2.27 pthread_spin_init F
+GLIBC_2.27 pthread_spin_lock F
+GLIBC_2.27 pthread_spin_trylock F
+GLIBC_2.27 pthread_spin_unlock F
+GLIBC_2.27 pthread_testcancel F
+GLIBC_2.27 pthread_timedjoin_np F
+GLIBC_2.27 pthread_tryjoin_np F
+GLIBC_2.27 pthread_yield F
+GLIBC_2.27 pwrite F
+GLIBC_2.27 pwrite64 F
+GLIBC_2.27 raise F
+GLIBC_2.27 read F
+GLIBC_2.27 recv F
+GLIBC_2.27 recvfrom F
+GLIBC_2.27 recvmsg F
+GLIBC_2.27 sem_close F
+GLIBC_2.27 sem_destroy F
+GLIBC_2.27 sem_getvalue F
+GLIBC_2.27 sem_init F
+GLIBC_2.27 sem_open F
+GLIBC_2.27 sem_post F
+GLIBC_2.27 sem_timedwait F
+GLIBC_2.27 sem_trywait F
+GLIBC_2.27 sem_unlink F
+GLIBC_2.27 sem_wait F
+GLIBC_2.27 send F
+GLIBC_2.27 sendmsg F
+GLIBC_2.27 sendto F
+GLIBC_2.27 sigaction F
+GLIBC_2.27 sigwait F
+GLIBC_2.27 tcdrain F
+GLIBC_2.27 wait F
+GLIBC_2.27 waitpid F
+GLIBC_2.27 write F
diff --git a/sysdeps/unix/sysv/linux/csky/libresolv.abilist b/sysdeps/unix/sysv/linux/csky/libresolv.abilist
new file mode 100644
index 0000000..42af265
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libresolv.abilist
@@ -0,0 +1,80 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 __b64_ntop F
+GLIBC_2.27 __b64_pton F
+GLIBC_2.27 __dn_comp F
+GLIBC_2.27 __dn_count_labels F
+GLIBC_2.27 __dn_expand F
+GLIBC_2.27 __dn_skipname F
+GLIBC_2.27 __fp_nquery F
+GLIBC_2.27 __fp_query F
+GLIBC_2.27 __fp_resstat F
+GLIBC_2.27 __hostalias F
+GLIBC_2.27 __loc_aton F
+GLIBC_2.27 __loc_ntoa F
+GLIBC_2.27 __p_cdname F
+GLIBC_2.27 __p_cdnname F
+GLIBC_2.27 __p_class F
+GLIBC_2.27 __p_class_syms D 0x54
+GLIBC_2.27 __p_fqname F
+GLIBC_2.27 __p_fqnname F
+GLIBC_2.27 __p_option F
+GLIBC_2.27 __p_query F
+GLIBC_2.27 __p_rcode F
+GLIBC_2.27 __p_time F
+GLIBC_2.27 __p_type F
+GLIBC_2.27 __p_type_syms D 0x228
+GLIBC_2.27 __putlong F
+GLIBC_2.27 __putshort F
+GLIBC_2.27 __res_close F
+GLIBC_2.27 __res_dnok F
+GLIBC_2.27 __res_hnok F
+GLIBC_2.27 __res_hostalias F
+GLIBC_2.27 __res_isourserver F
+GLIBC_2.27 __res_mailok F
+GLIBC_2.27 __res_mkquery F
+GLIBC_2.27 __res_nameinquery F
+GLIBC_2.27 __res_nmkquery F
+GLIBC_2.27 __res_nquery F
+GLIBC_2.27 __res_nquerydomain F
+GLIBC_2.27 __res_nsearch F
+GLIBC_2.27 __res_nsend F
+GLIBC_2.27 __res_ownok F
+GLIBC_2.27 __res_queriesmatch F
+GLIBC_2.27 __res_query F
+GLIBC_2.27 __res_querydomain F
+GLIBC_2.27 __res_search F
+GLIBC_2.27 __res_send F
+GLIBC_2.27 __sym_ntop F
+GLIBC_2.27 __sym_ntos F
+GLIBC_2.27 __sym_ston F
+GLIBC_2.27 _getlong F
+GLIBC_2.27 _getshort F
+GLIBC_2.27 inet_net_ntop F
+GLIBC_2.27 inet_net_pton F
+GLIBC_2.27 inet_neta F
+GLIBC_2.27 ns_datetosecs F
+GLIBC_2.27 ns_format_ttl F
+GLIBC_2.27 ns_get16 F
+GLIBC_2.27 ns_get32 F
+GLIBC_2.27 ns_initparse F
+GLIBC_2.27 ns_makecanon F
+GLIBC_2.27 ns_msg_getflag F
+GLIBC_2.27 ns_name_compress F
+GLIBC_2.27 ns_name_ntol F
+GLIBC_2.27 ns_name_ntop F
+GLIBC_2.27 ns_name_pack F
+GLIBC_2.27 ns_name_pton F
+GLIBC_2.27 ns_name_rollback F
+GLIBC_2.27 ns_name_skip F
+GLIBC_2.27 ns_name_uncompress F
+GLIBC_2.27 ns_name_unpack F
+GLIBC_2.27 ns_parse_ttl F
+GLIBC_2.27 ns_parserr F
+GLIBC_2.27 ns_put16 F
+GLIBC_2.27 ns_put32 F
+GLIBC_2.27 ns_samedomain F
+GLIBC_2.27 ns_samename F
+GLIBC_2.27 ns_skiprr F
+GLIBC_2.27 ns_sprintrr F
+GLIBC_2.27 ns_sprintrrf F
+GLIBC_2.27 ns_subdomain F
diff --git a/sysdeps/unix/sysv/linux/csky/librt.abilist b/sysdeps/unix/sysv/linux/csky/librt.abilist
new file mode 100644
index 0000000..8442d01
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/librt.abilist
@@ -0,0 +1,36 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 __mq_open_2 F
+GLIBC_2.27 aio_cancel F
+GLIBC_2.27 aio_cancel64 F
+GLIBC_2.27 aio_error F
+GLIBC_2.27 aio_error64 F
+GLIBC_2.27 aio_fsync F
+GLIBC_2.27 aio_fsync64 F
+GLIBC_2.27 aio_init F
+GLIBC_2.27 aio_read F
+GLIBC_2.27 aio_read64 F
+GLIBC_2.27 aio_return F
+GLIBC_2.27 aio_return64 F
+GLIBC_2.27 aio_suspend F
+GLIBC_2.27 aio_suspend64 F
+GLIBC_2.27 aio_write F
+GLIBC_2.27 aio_write64 F
+GLIBC_2.27 lio_listio F
+GLIBC_2.27 lio_listio64 F
+GLIBC_2.27 mq_close F
+GLIBC_2.27 mq_getattr F
+GLIBC_2.27 mq_notify F
+GLIBC_2.27 mq_open F
+GLIBC_2.27 mq_receive F
+GLIBC_2.27 mq_send F
+GLIBC_2.27 mq_setattr F
+GLIBC_2.27 mq_timedreceive F
+GLIBC_2.27 mq_timedsend F
+GLIBC_2.27 mq_unlink F
+GLIBC_2.27 shm_open F
+GLIBC_2.27 shm_unlink F
+GLIBC_2.27 timer_create F
+GLIBC_2.27 timer_delete F
+GLIBC_2.27 timer_getoverrun F
+GLIBC_2.27 timer_gettime F
+GLIBC_2.27 timer_settime F
diff --git a/sysdeps/unix/sysv/linux/csky/libthread_db.abilist b/sysdeps/unix/sysv/linux/csky/libthread_db.abilist
new file mode 100644
index 0000000..3d34d78
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libthread_db.abilist
@@ -0,0 +1,41 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 td_init F
+GLIBC_2.27 td_log F
+GLIBC_2.27 td_symbol_list F
+GLIBC_2.27 td_ta_clear_event F
+GLIBC_2.27 td_ta_delete F
+GLIBC_2.27 td_ta_enable_stats F
+GLIBC_2.27 td_ta_event_addr F
+GLIBC_2.27 td_ta_event_getmsg F
+GLIBC_2.27 td_ta_get_nthreads F
+GLIBC_2.27 td_ta_get_ph F
+GLIBC_2.27 td_ta_get_stats F
+GLIBC_2.27 td_ta_map_id2thr F
+GLIBC_2.27 td_ta_map_lwp2thr F
+GLIBC_2.27 td_ta_new F
+GLIBC_2.27 td_ta_reset_stats F
+GLIBC_2.27 td_ta_set_event F
+GLIBC_2.27 td_ta_setconcurrency F
+GLIBC_2.27 td_ta_thr_iter F
+GLIBC_2.27 td_ta_tsd_iter F
+GLIBC_2.27 td_thr_clear_event F
+GLIBC_2.27 td_thr_dbresume F
+GLIBC_2.27 td_thr_dbsuspend F
+GLIBC_2.27 td_thr_event_enable F
+GLIBC_2.27 td_thr_event_getmsg F
+GLIBC_2.27 td_thr_get_info F
+GLIBC_2.27 td_thr_getfpregs F
+GLIBC_2.27 td_thr_getgregs F
+GLIBC_2.27 td_thr_getxregs F
+GLIBC_2.27 td_thr_getxregsize F
+GLIBC_2.27 td_thr_set_event F
+GLIBC_2.27 td_thr_setfpregs F
+GLIBC_2.27 td_thr_setgregs F
+GLIBC_2.27 td_thr_setprio F
+GLIBC_2.27 td_thr_setsigpending F
+GLIBC_2.27 td_thr_setxregs F
+GLIBC_2.27 td_thr_sigsetmask F
+GLIBC_2.27 td_thr_tls_get_addr F
+GLIBC_2.27 td_thr_tlsbase F
+GLIBC_2.27 td_thr_tsd F
+GLIBC_2.27 td_thr_validate F
diff --git a/sysdeps/unix/sysv/linux/csky/libutil.abilist b/sysdeps/unix/sysv/linux/csky/libutil.abilist
new file mode 100644
index 0000000..612e168
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libutil.abilist
@@ -0,0 +1,7 @@
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 forkpty F
+GLIBC_2.27 login F
+GLIBC_2.27 login_tty F
+GLIBC_2.27 logout F
+GLIBC_2.27 logwtmp F
+GLIBC_2.27 openpty F
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 03/10] C-SKY: Generic math Routines
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 07/10] C-SKY: ABI Lists Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 09/10] C-SKY: Linux Startup and Dynamic Loading Code Mao Han
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

This patch contains the miscellaneous math routines and headers we have
implemented for C-SKY.

        * sysdeps/csky/bits/fenv.h: New file
        * sysdeps/csky/libm-test-ulps: New file
        * sysdeps/csky/libm-test-ulps-name: New file
        * sysdeps/csky/math-tests.h: New file
        * sysdeps/csky/sfp-machine.h: New file
        * sysdeps/csky/math_private.h: New file
        * sysdeps/csky/fenv_private.h: New file
---
 sysdeps/csky/bits/fenv.h         |   97 +++
 sysdeps/csky/fenv_private.h      |  288 +++++++
 sysdeps/csky/libm-test-ulps      | 1682 ++++++++++++++++++++++++++++++++++++++
 sysdeps/csky/libm-test-ulps-name |    1 +
 sysdeps/csky/math-tests.h        |   35 +
 sysdeps/csky/math_private.h      |    7 +
 sysdeps/csky/sfp-machine.h       |   50 ++
 7 files changed, 2160 insertions(+)
 create mode 100644 sysdeps/csky/bits/fenv.h
 create mode 100644 sysdeps/csky/fenv_private.h
 create mode 100644 sysdeps/csky/libm-test-ulps
 create mode 100644 sysdeps/csky/libm-test-ulps-name
 create mode 100644 sysdeps/csky/math-tests.h
 create mode 100644 sysdeps/csky/math_private.h
 create mode 100644 sysdeps/csky/sfp-machine.h

diff --git a/sysdeps/csky/bits/fenv.h b/sysdeps/csky/bits/fenv.h
new file mode 100644
index 0000000..fdd188a
--- /dev/null
+++ b/sysdeps/csky/bits/fenv.h
@@ -0,0 +1,97 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+/* Define bits representing the exception.  We use the bit positions
+   of the appropriate bits in the FPU control word.  */
+enum
+  {
+    FE_INVALID =
+#define FE_INVALID	0x01
+      FE_INVALID,
+    FE_DIVBYZERO =
+#define FE_DIVBYZERO	0x02
+      FE_DIVBYZERO,
+    FE_OVERFLOW =
+#define FE_OVERFLOW	0x04
+      FE_OVERFLOW,
+    FE_UNDERFLOW =
+#define FE_UNDERFLOW	0x08
+      FE_UNDERFLOW,
+    FE_INEXACT =
+#define FE_INEXACT	0x10
+      FE_INEXACT,
+    FE_DENORMAL =
+#define FE_DENORMAL	0x20
+      FE_DENORMAL,
+  };
+
+#define FE_ALL_EXCEPT \
+	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW |\
+         FE_INVALID | FE_DENORMAL)
+
+/* The C-SKY FPU supports all of the four defined rounding modes.  We
+   use again the bit positions in the FPU control word as the values
+   for the appropriate macros.  */
+enum
+  {
+    FE_TONEAREST =
+#define FE_TONEAREST	(0x0 << 24)
+      FE_TONEAREST,
+    FE_TOWARDZERO =
+#define FE_TOWARDZERO	(0x1 << 24)
+      FE_TOWARDZERO,
+    FE_UPWARD =
+#define FE_UPWARD	(0x2 << 24)
+      FE_UPWARD,
+    FE_DOWNWARD =
+#define FE_DOWNWARD	(0x3 << 24)
+      FE_DOWNWARD,
+    FE_ROUND_MASK =
+#define FE_ROUND_MASK	(0x3 << 24)
+      FE_ROUND_MASK
+  };
+
+/* Type representing exception flags.  */
+typedef unsigned int fexcept_t;
+
+/* Type representing floating-point environment. */
+typedef struct
+  {
+    unsigned int __fpcr;
+    unsigned int __fpsr;
+  }
+fenv_t;
+
+/* If the default argument is used we use this value.  */
+#define FE_DFL_ENV	((const fenv_t *) -1)
+
+#ifdef __USE_GNU
+/* Floating-point environment where none of the exceptions are masked.  */
+# define FE_NOMASK_ENV  ((const fenv_t *) -2)
+#endif
+
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+/* Type representing floating-point control modes.  */
+typedef unsigned int femode_t;
+
+/* Default floating-point control modes.  */
+# define FE_DFL_MODE	((const femode_t *) -1L)
+#endif
diff --git a/sysdeps/csky/fenv_private.h b/sysdeps/csky/fenv_private.h
new file mode 100644
index 0000000..dc15032
--- /dev/null
+++ b/sysdeps/csky/fenv_private.h
@@ -0,0 +1,288 @@
+/* Private floating point rounding and exceptions handling. C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef FENV_PRIVATE_H
+#define FENV_PRIVATE_H 1
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+#ifdef __csky_hard_float__
+# include <fenv_libc.h>
+
+static __always_inline void
+libc_feholdexcept_vfp (fenv_t *envp)
+{
+  unsigned int fpsr;
+  unsigned int fpcr;
+
+  _FPU_GETCW (fpcr);
+  envp->__fpcr = fpcr;
+
+  _FPU_GETFPSR (fpsr);
+  envp->__fpsr = fpsr;
+
+  /* Now set all exceptions to non-stop.  */
+  fpcr &= ~FE_ALL_EXCEPT;
+
+  /* And clear all exception flags.  */
+  fpsr &= ~(FE_ALL_EXCEPT << CAUSE_SHIFT);
+
+  _FPU_SETFPSR (fpsr);
+
+  _FPU_SETCW (fpcr);
+}
+
+static __always_inline void
+libc_fesetround_vfp (int round)
+{
+  fpu_control_t fpcr;
+
+  _FPU_GETCW (fpcr);
+
+  /* Set new rounding mode if different.  */
+  if (__glibc_unlikely ((fpcr & FE_DOWNWARD) != round))
+    _FPU_SETCW ((fpcr & ~FE_DOWNWARD) | round);
+}
+
+static __always_inline void
+libc_feholdexcept_setround_vfp (fenv_t *envp, int round)
+{
+  fpu_control_t fpsr;
+  fpu_control_t fpcr;
+
+  _FPU_GETCW (fpcr);
+  envp->__fpcr = fpcr;
+
+  _FPU_GETFPSR (fpsr);
+  envp->__fpsr = fpsr;
+
+  /* Clear exception flags, set all exceptions to non-stop,
+     and set new rounding mode.  */
+  fpcr &= ~(FE_ALL_EXCEPT | FE_DOWNWARD);
+  _FPU_SETCW (fpcr | round);
+
+  fpsr &= ~(FE_ALL_EXCEPT << CAUSE_SHIFT);
+  _FPU_SETFPSR (fpsr);
+}
+
+static __always_inline void
+libc_feholdsetround_vfp (fenv_t *envp, int round)
+{
+  fpu_control_t fpcr;
+
+  _FPU_GETCW (fpcr);
+  envp->__fpcr = fpcr;
+
+  /* Set new rounding mode if different.  */
+  if (__glibc_unlikely ((fpcr & FE_DOWNWARD) != round))
+    _FPU_SETCW ((fpcr & ~FE_DOWNWARD) | round);
+}
+
+static __always_inline void
+libc_feresetround_vfp (fenv_t *envp)
+{
+  fpu_control_t fpcr, round;
+
+  _FPU_GETCW (fpcr);
+
+  /* Check whether rounding modes are different.  */
+  round = (envp->__fpcr ^ fpcr) & FE_DOWNWARD;
+
+  /* Restore the rounding mode if it was changed.  */
+  if (__glibc_unlikely (round != 0))
+    _FPU_SETCW (fpcr ^ round);
+}
+
+static __always_inline int
+libc_fetestexcept_vfp (int ex)
+{
+  fpu_control_t fpsr;
+
+  _FPU_GETFPSR (fpsr);
+  fpsr = fpsr >> CAUSE_SHIFT;
+  return fpsr & ex & FE_ALL_EXCEPT;
+}
+
+static __always_inline void
+libc_fesetenv_vfp (const fenv_t *envp)
+{
+  unsigned int fpcr;
+  unsigned int fpsr;
+
+  _FPU_GETCW (fpcr);
+  _FPU_GETFPSR (fpsr);
+
+  fpcr &= _FPU_RESERVED;
+  fpsr &= _FPU_FPSR_RESERVED;
+
+  if (envp == FE_DFL_ENV)
+    {
+      fpcr |= _FPU_DEFAULT;
+      fpsr |= _FPU_FPSR_DEFAULT;
+    }
+  else if (envp == FE_NOMASK_ENV)
+    {
+      fpcr |= _FPU_FPCR_IEEE;
+      fpsr |= _FPU_FPSR_IEEE;
+    }
+  else
+    {
+      fpcr |= envp->__fpcr & ~_FPU_RESERVED;
+      fpsr |= envp->__fpsr & ~_FPU_FPSR_RESERVED;
+    }
+
+  _FPU_SETFPSR (fpsr);
+
+  _FPU_SETCW (fpcr);
+}
+
+static __always_inline int
+libc_feupdateenv_test_vfp (const fenv_t *envp, int ex)
+{
+  fpu_control_t fpsr, new_fpsr;
+  int excepts;
+
+  _FPU_GETFPSR (fpsr);
+
+  /* Merge current exception flags with the saved fenv.  */
+  excepts = (fpsr >> CAUSE_SHIFT) & FE_ALL_EXCEPT;
+  new_fpsr = envp->__fpsr | (excepts << CAUSE_SHIFT);
+
+  /* Write new FPSCR if different (ignoring NZCV flags).  */
+  if (__glibc_unlikely (((fpsr ^ new_fpsr)) != 0))
+    _FPU_SETFPSR (new_fpsr);
+
+  /* Raise the exceptions if enabled in the new FP state.  */
+  if (__glibc_unlikely (excepts & (new_fpsr >> CAUSE_SHIFT)))
+    __feraiseexcept (excepts);
+
+  return excepts & ex;
+}
+
+static __always_inline void
+libc_feupdateenv_vfp (const fenv_t *envp)
+{
+  libc_feupdateenv_test_vfp (envp, 0);
+}
+
+static __always_inline void
+libc_feholdsetround_vfp_ctx (struct rm_ctx *ctx, int r)
+{
+  fpu_control_t fpcr, round;
+
+  _FPU_GETCW (fpcr);
+  ctx->updated_status = false;
+  ctx->env.__fpcr = fpcr;
+
+  /* Check whether rounding modes are different.  */
+  round = (fpcr ^ r) & FE_DOWNWARD;
+
+  /* Set the rounding mode if changed.  */
+  if (__glibc_unlikely (round != 0))
+    {
+      ctx->updated_status = true;
+      _FPU_SETCW (fpcr ^ round);
+    }
+}
+
+static __always_inline void
+libc_feresetround_vfp_ctx (struct rm_ctx *ctx)
+{
+  /* Restore the rounding mode if updated.  */
+  if (__glibc_unlikely (ctx->updated_status))
+    {
+      fpu_control_t fpcr;
+
+      _FPU_GETCW (fpcr);
+      fpcr = (fpcr & ~FE_DOWNWARD) | (ctx->env.__fpcr & FE_DOWNWARD);
+      _FPU_SETCW (fpcr);
+    }
+}
+
+static __always_inline void
+libc_fesetenv_vfp_ctx (struct rm_ctx *ctx)
+{
+  fpu_control_t fpcr, new_fpcr;
+
+  _FPU_GETCW (fpcr);
+  new_fpcr = ctx->env.__fpcr;
+
+  /* Write new FPSCR if different (ignoring NZCV flags).  */
+  if (__glibc_unlikely (((fpcr ^ new_fpcr)) != 0))
+    _FPU_SETCW (new_fpcr);
+}
+
+# define libc_feholdexcept  libc_feholdexcept_vfp
+# define libc_feholdexceptf libc_feholdexcept_vfp
+# define libc_feholdexceptl libc_feholdexcept_vfp
+
+# define libc_fesetround  libc_fesetround_vfp
+# define libc_fesetroundf libc_fesetround_vfp
+# define libc_fesetroundl libc_fesetround_vfp
+
+# define libc_feresetround  libc_feresetround_vfp
+# define libc_feresetroundf libc_feresetround_vfp
+# define libc_feresetroundl libc_feresetround_vfp
+
+# define libc_feresetround_noex  libc_fesetenv_vfp
+# define libc_feresetround_noexf libc_fesetenv_vfp
+# define libc_feresetround_noexl libc_fesetenv_vfp
+
+# define libc_feholdexcept_setround  libc_feholdexcept_setround_vfp
+# define libc_feholdexcept_setroundf libc_feholdexcept_setround_vfp
+# define libc_feholdexcept_setroundl libc_feholdexcept_setround_vfp
+
+# define libc_feholdsetround  libc_feholdsetround_vfp
+# define libc_feholdsetroundf libc_feholdsetround_vfp
+# define libc_feholdsetroundl libc_feholdsetround_vfp
+
+# define libc_fetestexcept  libc_fetestexcept_vfp
+# define libc_fetestexceptf libc_fetestexcept_vfp
+# define libc_fetestexceptl libc_fetestexcept_vfp
+
+# define libc_fesetenv  libc_fesetenv_vfp
+# define libc_fesetenvf libc_fesetenv_vfp
+# define libc_fesetenvl libc_fesetenv_vfp
+
+# define libc_feupdateenv  libc_feupdateenv_vfp
+# define libc_feupdateenvf libc_feupdateenv_vfp
+# define libc_feupdateenvl libc_feupdateenv_vfp
+
+# define libc_feupdateenv_test  libc_feupdateenv_test_vfp
+# define libc_feupdateenv_testf libc_feupdateenv_test_vfp
+# define libc_feupdateenv_testl libc_feupdateenv_test_vfp
+
+/* We have support for rounding mode context.  */
+# define HAVE_RM_CTX 1
+
+# define libc_feholdsetround_ctx	libc_feholdsetround_vfp_ctx
+# define libc_feresetround_ctx		libc_feresetround_vfp_ctx
+# define libc_feresetround_noex_ctx	libc_fesetenv_vfp_ctx
+
+# define libc_feholdsetroundf_ctx	libc_feholdsetround_vfp_ctx
+# define libc_feresetroundf_ctx		libc_feresetround_vfp_ctx
+# define libc_feresetround_noexf_ctx	libc_fesetenv_vfp_ctx
+
+# define libc_feholdsetroundl_ctx	libc_feholdsetround_vfp_ctx
+# define libc_feresetroundl_ctx		libc_feresetround_vfp_ctx
+# define libc_feresetround_noexl_ctx	libc_fesetenv_vfp_ctx
+
+#endif /* __csky_hard_float__ */
+
+#endif /* FENV_PRIVATE_H */
diff --git a/sysdeps/csky/libm-test-ulps b/sysdeps/csky/libm-test-ulps
new file mode 100644
index 0000000..aa3d696
--- /dev/null
+++ b/sysdeps/csky/libm-test-ulps
@@ -0,0 +1,1682 @@
+# Begin of automatic generation
+
+# Maximal error of functions:
+Function: "acos":
+float: 1
+ifloat: 1
+
+Function: "acos_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "acos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "acos_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "acosh":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "acosh_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "acosh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "acosh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "asin":
+float: 1
+ifloat: 1
+
+Function: "asin_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "asin_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "asin_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "asinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "asinh_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "asinh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "asinh_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "atan":
+float: 1
+ifloat: 1
+
+Function: "atan2":
+float: 1
+ifloat: 1
+
+Function: "atan2_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "atan2_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "atan2_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "atan_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "atan_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "atan_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "atanh":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "atanh_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "atanh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "atanh_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "cabs":
+double: 1
+idouble: 1
+
+Function: "cabs_downward":
+double: 1
+idouble: 1
+
+Function: "cabs_towardzero":
+double: 1
+idouble: 1
+
+Function: "cabs_upward":
+double: 1
+idouble: 1
+
+Function: Real part of "cacos":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "cacos":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "cacos_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "cacos_downward":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Real part of "cacos_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "cacos_towardzero":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Real part of "cacos_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "cacos_upward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: Real part of "cacosh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "cacosh_downward":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Imaginary part of "cacosh_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "cacosh_towardzero":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Imaginary part of "cacosh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "cacosh_upward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: Imaginary part of "cacosh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "carg":
+float: 1
+ifloat: 1
+
+Function: "carg_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "carg_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "carg_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "casin":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "casin_downward":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+
+Function: Imaginary part of "casin_downward":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Real part of "casin_towardzero":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+
+Function: Imaginary part of "casin_towardzero":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Real part of "casin_upward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Imaginary part of "casin_upward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: Real part of "casinh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "casinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "casinh_downward":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Imaginary part of "casinh_downward":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+
+Function: Real part of "casinh_towardzero":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Imaginary part of "casinh_towardzero":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+
+Function: Real part of "casinh_upward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: Imaginary part of "casinh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "catan":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "catan_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "catan_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "catan_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "catan_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Real part of "catan_upward":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "catan_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: Real part of "catanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "catanh":
+float: 1
+ifloat: 1
+
+Function: Real part of "catanh_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "catanh_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "catanh_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Imaginary part of "catanh_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "catanh_upward":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+
+Function: Imaginary part of "catanh_upward":
+float: 1
+ifloat: 1
+
+Function: "cbrt":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+
+Function: "cbrt_downward":
+double: 4
+float: 1
+idouble: 4
+ifloat: 1
+
+Function: "cbrt_towardzero":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+
+Function: "cbrt_upward":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "ccos_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccos_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Real part of "ccos_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "ccos_towardzero":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Real part of "ccos_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "ccos_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "ccosh_downward":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Imaginary part of "ccosh_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Real part of "ccosh_towardzero":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Imaginary part of "ccosh_towardzero":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Real part of "ccosh_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "ccosh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "cexp":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Imaginary part of "cexp":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "cexp_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "cexp_downward":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Real part of "cexp_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "cexp_towardzero":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Real part of "cexp_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "cexp_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "clog":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: Imaginary part of "clog":
+float: 1
+ifloat: 1
+
+Function: Real part of "clog10":
+double: 3
+float: 4
+idouble: 3
+ifloat: 4
+
+Function: Imaginary part of "clog10":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "clog10_downward":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: Imaginary part of "clog10_downward":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+
+Function: Real part of "clog10_towardzero":
+double: 5
+float: 5
+idouble: 5
+ifloat: 5
+
+Function: Imaginary part of "clog10_towardzero":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+
+Function: Real part of "clog10_upward":
+double: 6
+float: 5
+idouble: 6
+ifloat: 5
+
+Function: Imaginary part of "clog10_upward":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+
+Function: Real part of "clog_downward":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+
+Function: Imaginary part of "clog_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "clog_towardzero":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: Imaginary part of "clog_towardzero":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Real part of "clog_upward":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+
+Function: Imaginary part of "clog_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "cos":
+float: 1
+ifloat: 1
+
+Function: "cos_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "cos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "cos_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "cosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "cosh_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "cosh_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "cosh_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "cpow":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+
+Function: Imaginary part of "cpow":
+float: 2
+ifloat: 2
+
+Function: Real part of "cpow_downward":
+double: 4
+float: 8
+idouble: 4
+ifloat: 8
+
+Function: Imaginary part of "cpow_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "cpow_towardzero":
+double: 4
+float: 8
+idouble: 4
+ifloat: 8
+
+Function: Imaginary part of "cpow_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "cpow_upward":
+double: 4
+float: 1
+idouble: 4
+ifloat: 1
+
+Function: Imaginary part of "cpow_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "csin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csin_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Imaginary part of "csin_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csin_towardzero":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Imaginary part of "csin_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csin_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "csin_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csinh_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "csinh_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Real part of "csinh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "csinh_towardzero":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Real part of "csinh_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "csinh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "csqrt":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "csqrt":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "csqrt_downward":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: Imaginary part of "csqrt_downward":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+
+Function: Real part of "csqrt_towardzero":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+
+Function: Imaginary part of "csqrt_towardzero":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+
+Function: Real part of "csqrt_upward":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: Imaginary part of "csqrt_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: Real part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ctan":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Real part of "ctan_downward":
+double: 6
+float: 5
+idouble: 6
+ifloat: 5
+
+Function: Imaginary part of "ctan_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Real part of "ctan_towardzero":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Imaginary part of "ctan_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "ctan_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Imaginary part of "ctan_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Real part of "ctanh":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Imaginary part of "ctanh":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "ctanh_downward":
+double: 4
+float: 1
+idouble: 4
+ifloat: 1
+
+Function: Imaginary part of "ctanh_downward":
+double: 6
+float: 5
+idouble: 6
+ifloat: 5
+
+Function: Real part of "ctanh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "ctanh_towardzero":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+
+Function: Real part of "ctanh_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: Imaginary part of "ctanh_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: "erf":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "erf_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "erf_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "erf_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "erfc":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "erfc_downward":
+double: 5
+float: 6
+idouble: 5
+ifloat: 6
+
+Function: "erfc_towardzero":
+double: 3
+float: 4
+idouble: 3
+ifloat: 4
+
+Function: "erfc_upward":
+double: 5
+float: 6
+idouble: 5
+ifloat: 6
+
+Function: "exp":
+float: 1
+ifloat: 1
+
+Function: "exp10":
+double: 2
+idouble: 2
+
+Function: "exp10_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "exp10_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "exp10_upward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "exp2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "exp2_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "exp2_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "exp2_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "exp_downward":
+double: 1
+idouble: 1
+
+Function: "exp_towardzero":
+double: 1
+idouble: 1
+
+Function: "exp_upward":
+double: 1
+idouble: 1
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "expm1_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "expm1_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "expm1_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "gamma":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: "gamma_downward":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: "gamma_towardzero":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: "gamma_upward":
+double: 5
+float: 5
+idouble: 5
+ifloat: 5
+
+Function: "hypot":
+double: 1
+idouble: 1
+
+Function: "hypot_downward":
+double: 1
+idouble: 1
+
+Function: "hypot_towardzero":
+double: 1
+idouble: 1
+
+Function: "hypot_upward":
+double: 1
+idouble: 1
+
+Function: "j0":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "j0_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: "j0_towardzero":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "j0_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "j1_downward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "j1_towardzero":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "j1_upward":
+double: 3
+float: 5
+idouble: 3
+ifloat: 5
+
+Function: "jn":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: "jn_downward":
+double: 5
+float: 5
+idouble: 5
+ifloat: 5
+
+Function: "jn_towardzero":
+double: 5
+float: 5
+idouble: 5
+ifloat: 5
+
+Function: "jn_upward":
+double: 5
+float: 5
+idouble: 5
+ifloat: 5
+
+Function: "lgamma":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: "lgamma_downward":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: "lgamma_towardzero":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: "lgamma_upward":
+double: 5
+float: 5
+idouble: 5
+ifloat: 5
+
+Function: "log":
+float: 1
+ifloat: 1
+
+Function: "log10":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "log10_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+
+Function: "log10_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "log10_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "log1p":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "log1p_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "log1p_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "log1p_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "log2":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "log2_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "log2_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "log2_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "log_downward":
+float: 2
+ifloat: 2
+
+Function: "log_towardzero":
+float: 2
+ifloat: 2
+
+Function: "log_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "pow":
+float: 1
+ifloat: 1
+
+Function: "pow10":
+double: 2
+idouble: 2
+
+Function: "pow10_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "pow10_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "pow10_upward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "pow_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "pow_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "pow_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "sin":
+float: 1
+ifloat: 1
+
+Function: "sin_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "sin_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "sin_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "sincos":
+float: 1
+ifloat: 1
+
+Function: "sincos_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "sincos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "sincos_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "sinh":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "sinh_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "sinh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "sinh_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "tan":
+float: 1
+ifloat: 1
+
+Function: "tan_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "tan_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "tan_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "tanh":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "tanh_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "tanh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "tanh_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "tgamma":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: "tgamma_downward":
+double: 5
+float: 5
+idouble: 5
+ifloat: 5
+
+Function: "tgamma_towardzero":
+double: 5
+float: 4
+idouble: 5
+ifloat: 4
+
+Function: "tgamma_upward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "y0_downward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "y0_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "y0_upward":
+double: 3
+float: 4
+idouble: 3
+ifloat: 4
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "y1_downward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "y1_towardzero":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "y1_upward":
+double: 7
+float: 2
+idouble: 7
+ifloat: 2
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "yn_downward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "yn_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+
+Function: "yn_upward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+# end of automatic generation
diff --git a/sysdeps/csky/libm-test-ulps-name b/sysdeps/csky/libm-test-ulps-name
new file mode 100644
index 0000000..236b0fb
--- /dev/null
+++ b/sysdeps/csky/libm-test-ulps-name
@@ -0,0 +1 @@
+CSKY
diff --git a/sysdeps/csky/math-tests.h b/sysdeps/csky/math-tests.h
new file mode 100644
index 0000000..30d9b73
--- /dev/null
+++ b/sysdeps/csky/math-tests.h
@@ -0,0 +1,35 @@
+/* Configuration for math tests.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* On systems with VFP support, but where glibc is built for
+   soft-float, the libgcc functions used in libc and libm do not
+   support rounding modes, although fesetround succeeds, and do not
+   support exceptions.  */
+#ifdef __CSKY_SOFT_FLOAT__
+# define ROUNDING_TESTS_float(MODE)	((MODE) == FE_TONEAREST)
+# define ROUNDING_TESTS_double(MODE)	((MODE) == FE_TONEAREST)
+# define ROUNDING_TESTS_long_double(MODE)	((MODE) == FE_TONEAREST)
+# define EXCEPTION_TESTS_float	0
+# define EXCEPTION_TESTS_double	0
+# define EXCEPTION_TESTS_long_double	0
+#endif
+
+/* Not all VFP implementations support trapping exceptions.  */
+#define EXCEPTION_ENABLE_SUPPORTED(EXCEPT)	((EXCEPT) == 0)
+
+#include_next <math-tests.h>
diff --git a/sysdeps/csky/math_private.h b/sysdeps/csky/math_private.h
new file mode 100644
index 0000000..db303da
--- /dev/null
+++ b/sysdeps/csky/math_private.h
@@ -0,0 +1,7 @@
+#ifndef CSKY_MATH_PRIVATE_H
+#define CSKY_MATH_PRIVATE_H 1
+
+#include "fenv_private.h"
+#include_next <math_private.h>
+
+#endif
diff --git a/sysdeps/csky/sfp-machine.h b/sysdeps/csky/sfp-machine.h
new file mode 100644
index 0000000..69c6f33
--- /dev/null
+++ b/sysdeps/csky/sfp-machine.h
@@ -0,0 +1,50 @@
+#define _FP_W_TYPE_SIZE		32
+#define _FP_W_TYPE		unsigned long
+#define _FP_WS_TYPE		signed long
+#define _FP_I_TYPE		long
+
+#define _FP_MUL_MEAT_S(R,X,Y)				\
+  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_D(R,X,Y)				\
+  _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_Q(R,X,Y)				\
+  _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_MUL_MEAT_DW_S(R,X,Y)				\
+  _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_DW_D(R,X,Y)				\
+  _FP_MUL_MEAT_DW_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_DW_Q(R,X,Y)				\
+  _FP_MUL_MEAT_DW_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_loop(S,R,X,Y)
+#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
+
+#define _FP_NANFRAC_S		_FP_QNANBIT_S
+#define _FP_NANFRAC_D		_FP_QNANBIT_D, 0
+#define _FP_NANFRAC_Q		_FP_QNANBIT_Q, 0, 0, 0
+#define _FP_NANSIGN_S		0
+#define _FP_NANSIGN_D		0
+#define _FP_NANSIGN_Q		0
+
+#define _FP_KEEPNANFRACP 1
+#define _FP_QNANNEGATEDP 0
+
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
+  do {								\
+    if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)		\
+	&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))	\
+      {								\
+	R##_s = Y##_s;						\
+	_FP_FRAC_COPY_##wc(R,Y);				\
+      }								\
+    else							\
+      {								\
+	R##_s = X##_s;						\
+	_FP_FRAC_COPY_##wc(R,X);				\
+      }								\
+    R##_c = FP_CLS_NAN;						\
+  } while (0)
+
+#define _FP_TININESS_AFTER_ROUNDING 0
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 01/10] C-SKY: ABI related code
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (4 preceding siblings ...)
  2018-04-08  7:03 ` [RFC PATCH V2 08/10] C-SKY: Build Infastructure Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-17 20:53   ` Joseph Myers
  2018-04-08  7:03 ` [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface Mao Han
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

Codes in this patch contains lots of C-SKY ABI related code. They are written
accroding to the registers assgnments, relocations, assemblly described
in C-SKY CPU ABI Standards and C-SKY CPU manual.
This does not contain any linux related code.

        * sysdeps/csky/__longjmp.S: New file
        * sysdeps/csky/backtrace.c: New file
        * sysdeps/csky/bits/endian.h: New file
        * sysdeps/csky/bits/setjmp.h: New file
        * sysdeps/csky/bsd-_setjmp.S: New file
        * sysdeps/csky/bsd-setjmp.S: New file
        * sysdeps/csky/dl-trampoline.S: New file
        * sysdeps/csky/gccframe.h: New file
        * sysdeps/csky/jmpbuf-unwind.h: New file
        * sysdeps/csky/setjmp.S: New file
        * sysdeps/csky/tls-macros.h: New file
        * sysdeps/csky/crti.S: New file
        * sysdeps/csky/crtn.S: New file
        * sysdeps/csky/csky-mcount.S: New file
        * sysdeps/csky/abort-instr.h: New file
        * sysdeps/unix/csky/abiv2_sysdep.S: New file
        * sysdeps/unix/csky/sysdep.S: New file
        * sysdeps/unix/csky/sysdep.h: New file
        * sysdeps/csky/start.S: New file
        * sysdeps/csky/strcmp.S: New file
        * sysdeps/csky/strcpy.S: New file
        * sysdeps/csky/memcpy.S: New file
        * sysdeps/csky/macro.S: New file
        * sysdeps/csky/memusage.h: New file
        * sysdeps/csky/machine-gmon.h: New file
        * sysdeps/csky/bits/link.h: New file
        * sysdeps/csky/sys/ucontext.h: New file
        * sysdeps/csky/sysdep.h: New file
---
 sysdeps/csky/__longjmp.S         |  74 ++++++++
 sysdeps/csky/abort-instr.h       |   2 +
 sysdeps/csky/backtrace.c         | 128 +++++++++++++
 sysdeps/csky/bits/endian.h       |  10 +
 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/crti.S              |  96 ++++++++++
 sysdeps/csky/crtn.S              |  50 +++++
 sysdeps/csky/csky-mcount.S       |  87 +++++++++
 sysdeps/csky/dl-trampoline.S     |  88 +++++++++
 sysdeps/csky/gccframe.h          |  21 ++
 sysdeps/csky/jmpbuf-unwind.h     |  47 +++++
 sysdeps/csky/machine-gmon.h      |  32 ++++
 sysdeps/csky/macro.S             |  30 +++
 sysdeps/csky/memcpy.S            | 400 +++++++++++++++++++++++++++++++++++++++
 sysdeps/csky/memusage.h          |  20 ++
 sysdeps/csky/setjmp.S            | 113 +++++++++++
 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/unix/csky/abiv2_sysdep.S |  63 ++++++
 sysdeps/unix/csky/sysdep.S       |  74 ++++++++
 sysdeps/unix/csky/sysdep.h       |  26 +++
 28 files changed, 2460 insertions(+)
 create mode 100644 sysdeps/csky/__longjmp.S
 create mode 100644 sysdeps/csky/abort-instr.h
 create mode 100644 sysdeps/csky/backtrace.c
 create mode 100644 sysdeps/csky/bits/endian.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/crti.S
 create mode 100644 sysdeps/csky/crtn.S
 create mode 100644 sysdeps/csky/csky-mcount.S
 create mode 100644 sysdeps/csky/dl-trampoline.S
 create mode 100644 sysdeps/csky/gccframe.h
 create mode 100644 sysdeps/csky/jmpbuf-unwind.h
 create mode 100644 sysdeps/csky/machine-gmon.h
 create mode 100644 sysdeps/csky/macro.S
 create mode 100644 sysdeps/csky/memcpy.S
 create mode 100644 sysdeps/csky/memusage.h
 create mode 100644 sysdeps/csky/setjmp.S
 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/unix/csky/abiv2_sysdep.S
 create mode 100644 sysdeps/unix/csky/sysdep.S
 create mode 100644 sysdeps/unix/csky/sysdep.h

diff --git a/sysdeps/csky/__longjmp.S b/sysdeps/csky/__longjmp.S
new file mode 100644
index 0000000..ee32cc0
--- /dev/null
+++ b/sysdeps/csky/__longjmp.S
@@ -0,0 +1,74 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+ENTRY(__longjmp)
+	mov     a2, a0
+	mov     a0, a1		/* get the return value in place */
+	cmpnei  a0,	 0
+	bt      have_return
+	movi    a0, 1		/* can't let setjmp() return zero! */
+have_return:
+#ifdef CHECK_SP
+	ldw     r10, (a2, 0)	/* jmpbuf's sp */
+#ifdef PTR_MANGLE
+        PTR_DEMANGLE(r10, r10, a3)
+#endif
+	CHECK_SP(r10)
+#endif
+#ifdef __CSKYABIV2__
+	ldw     sp, (a2, 0)
+	ldw     lr, (a2, 4)
+	ldw     r4, (a2, 8)
+	ldw     r5, (a2, 12)
+	ldw     r6, (a2, 16)
+	ldw     r7, (a2, 20)
+	ldw     r8, (a2, 24)
+	ldw     r9, (a2, 28)
+	ldw     r10, (a2, 32)
+	ldw     r11, (a2, 36)
+	ldw     r16, (a2, 40)
+	ldw     r17, (a2, 44)
+	ldw     r26, (a2, 48)
+	ldw     r27, (a2, 52)
+	ldw     r28, (a2, 56)
+	ldw     r29, (a2, 60)
+	ldw     r30, (a2, 64)
+	ldw     r31, (a2, 68)
+	addi    a2, 72
+#else
+	ldw     sp, (a2, 0)
+	ldw     lr, (a2, 4)
+	ldw     r8, (a2, 8)
+	ldw     r9, (a2, 12)
+	ldw     r10, (a2, 16)
+	ldw     r11, (a2, 20)
+	ldw     r12, (a2, 24)
+	ldw     r13, (a2, 28)
+	ldw     r14, (a2, 32)
+	addi    a2, 32
+	addi	a2, 4
+#endif
+
+#ifdef PTR_MANGLE
+        PTR_DEMANGLE(sp, sp, a3)
+        PTR_DEMANGLE2(lr, lr, a3)
+#endif
+	jmp lr
+
+END(__longjmp)
diff --git a/sysdeps/csky/abort-instr.h b/sysdeps/csky/abort-instr.h
new file mode 100644
index 0000000..27a3536
--- /dev/null
+++ b/sysdeps/csky/abort-instr.h
@@ -0,0 +1,2 @@
+/* An instruction which should crash any program is a breakpoint.  */
+#define ABORT_INSTRUCTION asm ("bkpt")
diff --git a/sysdeps/csky/backtrace.c b/sysdeps/csky/backtrace.c
new file mode 100644
index 0000000..9a6f36c
--- /dev/null
+++ b/sysdeps/csky/backtrace.c
@@ -0,0 +1,128 @@
+/* Return backtrace of current program state.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <libc-lock.h>
+#include <dlfcn.h>
+#include <execinfo.h>
+#include <stdlib.h>
+#include <unwind.h>
+
+struct trace_arg
+{
+  void **array;
+  _Unwind_Word cfa;
+  int cnt;
+  int size;
+};
+
+#ifdef SHARED
+static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
+static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
+static _Unwind_Word (*unwind_getcfa) (struct _Unwind_Context *);
+static void *libgcc_handle;
+
+/* Dummy version in case libgcc_s does not contain the real code.  */
+static _Unwind_Word
+dummy_getcfa (struct _Unwind_Context *ctx __attribute__ ((unused)))
+{
+  return 0;
+}
+
+
+static void
+init (void)
+{
+  libgcc_handle = __libc_dlopen ("libgcc_s.so.1");
+
+  if (libgcc_handle == NULL)
+    return;
+
+  unwind_backtrace = __libc_dlsym (libgcc_handle, "_Unwind_Backtrace");
+  unwind_getip = __libc_dlsym (libgcc_handle, "_Unwind_GetIP");
+  if (unwind_getip == NULL)
+    unwind_backtrace = NULL;
+  unwind_getcfa = (__libc_dlsym (libgcc_handle, "_Unwind_GetCFA")
+		  ?: dummy_getcfa);
+}
+#else
+# define unwind_backtrace _Unwind_Backtrace
+# define unwind_getip _Unwind_GetIP
+# define unwind_getcfa _Unwind_GetCFA
+#endif
+
+static _Unwind_Reason_Code
+backtrace_helper (struct _Unwind_Context *ctx, void *a)
+{
+  struct trace_arg *arg = a;
+
+  /* We are first called with address in the __backtrace function.
+     Skip it.  */
+  if (arg->cnt != -1)
+    {
+      arg->array[arg->cnt] = (void *) unwind_getip (ctx);
+
+      /* Check whether we make any progress.  */
+      _Unwind_Word cfa = unwind_getcfa (ctx);
+
+      if (arg->cnt > 0 && arg->array[arg->cnt - 1] == arg->array[arg->cnt]
+	 && cfa == arg->cfa)
+       return _URC_END_OF_STACK;
+      arg->cfa = cfa;
+    }
+  if (++arg->cnt == arg->size)
+    return _URC_END_OF_STACK;
+  return _URC_NO_REASON;
+}
+
+int
+__backtrace (void **array, int size)
+{
+  struct trace_arg arg = { .array = array, .cfa = 0, .size = size, .cnt = -1 };
+#ifdef SHARED
+  __libc_once_define (static, once);
+
+  __libc_once (once, init);
+  if (unwind_backtrace == NULL)
+    return 0;
+#endif
+
+  if (size >= 1)
+    unwind_backtrace (backtrace_helper, &arg);
+
+  /* _Unwind_Backtrace seems to put NULL address above
+     _start.  Fix it up here.  */
+  if (arg.cnt > 1 && arg.array[arg.cnt - 1] == NULL)
+    --arg.cnt;
+  return arg.cnt != -1 ? arg.cnt : 0;
+}
+weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
+
+
+#ifdef SHARED
+/* Free all resources if necessary.  */
+libc_freeres_fn (free_mem)
+{
+  unwind_backtrace = NULL;
+  if (libgcc_handle != NULL)
+    {
+      __libc_dlclose (libgcc_handle);
+      libgcc_handle = NULL;
+    }
+}
+#endif
diff --git a/sysdeps/csky/bits/endian.h b/sysdeps/csky/bits/endian.h
new file mode 100644
index 0000000..cc66abb
--- /dev/null
+++ b/sysdeps/csky/bits/endian.h
@@ -0,0 +1,10 @@
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+/* CSKY can be either big or little endian.  */
+#ifdef __CSKYBE__
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/sysdeps/csky/bits/link.h b/sysdeps/csky/bits/link.h
new file mode 100644
index 0000000..87121ca
--- /dev/null
+++ b/sysdeps/csky/bits/link.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+/* Registers for entry into PLT on CSKY.  */
+typedef struct La_csky_regs
+  {
+    uint32_t lr_reg[4];
+    uint32_t lr_sp;
+    uint32_t lr_lr;
+  } La_csky_regs;
+
+/* Return values for calls from PLT on CSKY.  */
+typedef struct La_csky_retval
+  {
+    /* Up to four integer registers can be used for a return value.  */
+    uint32_t lrv_reg[4];
+    uint32_t lrv_v0;
+  } La_csky_retval;
+
+__BEGIN_DECLS
+
+extern Elf32_Addr la_csky_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
+				       uintptr_t *__refcook,
+				       uintptr_t *__defcook,
+				       La_csky_regs *__regs,
+				       unsigned int *__flags,
+				       const char *__symname,
+				       long int *__framesizep);
+extern unsigned int la_csky_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
+					uintptr_t *__refcook,
+					uintptr_t *__defcook,
+					const La_csky_regs *__inregs,
+					La_csky_retval *__outregs,
+					const char *__symname);
+
+__END_DECLS
diff --git a/sysdeps/csky/bits/setjmp.h b/sysdeps/csky/bits/setjmp.h
new file mode 100644
index 0000000..e5f71a6
--- /dev/null
+++ b/sysdeps/csky/bits/setjmp.h
@@ -0,0 +1,34 @@
+/* Define the machine-dependent type `jmp_buf'. C-SKY version
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _CSKY_BITS_SETJMP_H
+#define _CSKY_BITS_SETJMP_H 1
+
+typedef struct __jmp_buf_str
+  {
+    /* Stack pointer.  */
+    int __sp;
+    int __lr;
+    /* The actual core defines which registers should be saved. The
+       buffer contains 32 words, keep space for future growth.
+       Callee-saved registers:
+       r4 ~ r11, r16 ~ r17, r26 ~r31 for abiv2; r8 ~ r14 for abiv1. */
+    int __regs[32];
+  } __jmp_buf[1];
+
+#endif
diff --git a/sysdeps/csky/bsd-_setjmp.S b/sysdeps/csky/bsd-_setjmp.S
new file mode 100644
index 0000000..4e6a2da
--- /dev/null
+++ b/sysdeps/csky/bsd-_setjmp.S
@@ -0,0 +1 @@
+/* _setjmp is in setjmp.S  */
diff --git a/sysdeps/csky/bsd-setjmp.S b/sysdeps/csky/bsd-setjmp.S
new file mode 100644
index 0000000..1da848d
--- /dev/null
+++ b/sysdeps/csky/bsd-setjmp.S
@@ -0,0 +1 @@
+/* setjmp is in setjmp.S  */
diff --git a/sysdeps/csky/crti.S b/sysdeps/csky/crti.S
new file mode 100644
index 0000000..163eccd
--- /dev/null
+++ b/sysdeps/csky/crti.S
@@ -0,0 +1,96 @@
+/* Special .init and .fini section support for C-SKY.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file with other
+   programs, and to distribute those programs without any restriction
+   coming from the use of this file. (The GNU Lesser General Public
+   License restrictions do apply in other respects; for example, they
+   cover modification of the file, and distribution when not linked
+   into another program.)
+
+   Note that people who make modified versions of this file are not
+   obligated to grant this special exception for their modified
+   versions; it is their choice whether to do so. The GNU Lesser
+   General Public License gives permission to release a modified
+   version without this exception; this exception also makes it
+   possible to release a modified version which carries forward this
+   exception.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* crti.S puts a function prologue at the beginning of the .init and
+   .fini sections and defines global symbols for those addresses, so
+   they can be called as functions.  The symbols _init and _fini are
+   magic and cause the linker to emit DT_INIT and DT_FINI.  */
+
+#include <libc-symbols.h>
+#include <sysdep.h>
+
+#ifndef PREINIT_FUNCTION
+# define PREINIT_FUNCTION __gmon_start__
+#endif
+
+#ifndef PREINIT_FUNCTION_WEAK
+# define PREINIT_FUNCTION_WEAK 1
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+	weak_extern (PREINIT_FUNCTION)
+#else
+	.hidden PREINIT_FUNCTION
+#endif
+
+	.section .init,"ax",@progbits
+	.align 4
+	.globl _init
+	.type _init, @function
+_init:
+	subi	sp, 8
+	stw	lr, (sp, 0)
+	stw     gb, (sp, 4)
+        bsr     .Lgetpc
+.Lgetpc:
+        lrw     gb, .Lgetpc@GOTPC
+	add	gb, lr
+#if PREINIT_FUNCTION_WEAK
+        lrw     a2, PREINIT_FUNCTION@GOT
+        addu    a2, gb
+        ldw     a2, (a2)
+        cmpnei  a2, 0
+        bf      1f
+        jsr     a2
+1:
+#else
+	jsri	PREINIT_FUNCTION
+#endif /* PREINIT_FUNCTION_WEAK */
+	br      2f
+	.literals
+	.align  4
+2:
+
+	.section .fini,"ax",@progbits
+	.align 4
+	.globl _fini
+	.type _fini, @function
+_fini:
+	subi	sp,8
+	stw	lr, (sp, 0)
+	br      2f
+	.literals
+	.align  4
+2:
diff --git a/sysdeps/csky/crtn.S b/sysdeps/csky/crtn.S
new file mode 100644
index 0000000..c7d5fbe
--- /dev/null
+++ b/sysdeps/csky/crtn.S
@@ -0,0 +1,50 @@
+/* Special .init and .fini section support for C-SKY.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file with other
+   programs, and to distribute those programs without any restriction
+   coming from the use of this file. (The GNU Lesser General Public
+   License restrictions do apply in other respects; for example, they
+   cover modification of the file, and distribution when not linked
+   into another program.)
+
+   Note that people who make modified versions of this file are not
+   obligated to grant this special exception for their modified
+   versions; it is their choice whether to do so. The GNU Lesser
+   General Public License gives permission to release a modified
+   version without this exception; this exception also makes it
+   possible to release a modified version which carries forward this
+   exception.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+   corresponding to the prologues in crti.S. */
+
+	.section .init,"ax",@progbits
+	ldw	lr, (sp, 0)
+	ldw     gb, (sp, 4)
+	addi	sp, 8
+	rts
+
+	.section .fini,"ax",@progbits
+	ldw	lr, (sp, 0)
+	addi	sp,8
+	rts
diff --git a/sysdeps/csky/csky-mcount.S b/sysdeps/csky/csky-mcount.S
new file mode 100644
index 0000000..22fda58
--- /dev/null
+++ b/sysdeps/csky/csky-mcount.S
@@ -0,0 +1,87 @@
+/* Implementation of profiling support.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Don't call mcount when calling mcount...  */
+#undef PROF
+
+#include <sysdep.h>
+
+/* Use an assembly stub with a special ABI.  The calling lr has been
+   pushed to the stack (which will be misaligned).  We should preserve
+   all registers except ip and pop a word off the stack.
+
+   NOTE: This assumes mcount_internal does not clobber any non-core
+   (coprocessor) registers.  Currently this is true, but may require
+   additional attention in the future.
+
+   The calling sequence looks something like:
+func:
+   push lr
+   jbsr __gnu_mount_nc
+   <function body>
+*/
+
+ENTRY(_mcount)
+#ifdef __CSKYABIV2__
+	subi	sp,20
+	stw	    a0,(sp, 0)
+	stw	    a1,(sp, 4)
+	stw	    a2,(sp, 8)
+	stw	    a3,(sp, 12)
+	stw	lr,(sp, 16)
+	mov	    a1, lr
+	ldw	a0, (sp, 20)
+	jbsr	__mcount_internal
+	ldw	a0,(sp, 0)
+	ldw	a1,(sp, 4)
+	ldw	a2,(sp, 8)
+	ldw	a3,(sp, 12)
+	ldw	t1,(sp, 16)
+	ldw	lr,(sp, 20)
+	addi	sp,24
+	jmp	t1
+#else
+	subi	sp,28
+	stw	    a0,(sp, 0)
+	stw	    a1,(sp, 4)
+	stw	    a2,(sp, 8)
+	stw	    a3,(sp, 12)
+	stw	    a4,(sp, 16)
+	stw	    a5,(sp, 20)
+	stw	lr,(sp, 24)
+	mov	    a1, lr
+	ldw	a0, (sp, 28)
+	jbsr	__mcount_internal
+	ldw	a0,(sp, 0)
+	ldw	a1,(sp, 4)
+	ldw	a2,(sp, 8)
+	ldw	a3,(sp, 12)
+	ldw	a4,(sp, 16)
+	ldw	a5,(sp, 20)
+	ldw	r1,(sp, 24)
+	ldw	lr,(sp, 28)
+	addi	sp,32
+	jmp	r1
+#endif
+
+END(_mcount)
+
+/* The canonical name for the function is `_mcount' in both C and asm,
+   but some old asm code might assume it's `mcount'.  */
+#undef mcount
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/csky/dl-trampoline.S b/sysdeps/csky/dl-trampoline.S
new file mode 100644
index 0000000..e02d90a
--- /dev/null
+++ b/sysdeps/csky/dl-trampoline.S
@@ -0,0 +1,88 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This function is not called directly. It is jumped when attempting to use a
+   symbol that has not yet been resolved.
+
+   .plt*:
+     subi r0, 32
+     stw r2, (r0, 0)
+     stw r3, (r0, 4)
+     lrw r3, #offset
+     ldw r2, (gb, 8)
+     jmp r2
+ */
+
+.import _dl_fixup
+
+.text
+.globl _dl_runtime_resolve
+.type  _dl_runtime_resolve,@function
+
+_dl_runtime_resolve:
+#if !defined(__CSKYABIV2__)
+	stw  r4, (r0, 8)
+	stw  r5, (r0, 12)
+	stw  r6, (r0, 16)
+	stw  r7, (r0, 20)
+	stw  r15,(r0, 24)
+	# load the ID of this module
+	ldw  r2, (gb, 4)
+	mov  r6, r3
+	addu r6, r6
+	addu r3, r6
+	lsli r3, 2
+	# r2 = id, r3 = offset(do it in plt*)
+	# get global offset table address_
+	bsr .L2
+.L2:
+	lrw r7, .L2@GOTPC
+	add r7, r15
+	# get the address of function (_dl_fixup) in got table
+	lrw r6, _dl_fixup@GOT
+	add r6, r7
+	ldw r5, (r6, 0)
+	jsr r5
+	# Return from _dl_fixup, the address of function is in r2
+	mov  r1, r2
+	# Restore the registers
+	ldw  r2, (r0, 0)
+	ldw  r3, (r0, 4)
+	ldw  r4, (r0, 8)
+	ldw  r5, (r0, 12)
+	ldw  r6, (r0, 16)
+	ldw  r7, (r0, 20)
+	ldw  r15,(r0, 24)
+	# Restore the r0, because r0 is subtracted in PLT table
+	addi r0, 32
+	# The address of function is in r1, call the function without saving pc
+	jmp  r1
+#else /* __CSKYABIV2__ */
+	subi sp, 20
+	stm  a0-a3, (sp)
+	stw  lr, (sp, 16)
+	# a0 = id, a1 = offset(do it in plt*)
+	ldw  a0,  (gb, 4)
+	movi a1, 12
+	mult a1, t1
+	bsr  _dl_fixup
+	mov  t0, a0
+	ldw  lr, (sp, 16)
+	ldm  a0-a3, (sp)
+	addi sp, 20
+	jmp  t0
+#endif /* __CSKYABIV2__ */
diff --git a/sysdeps/csky/gccframe.h b/sysdeps/csky/gccframe.h
new file mode 100644
index 0000000..9451101
--- /dev/null
+++ b/sysdeps/csky/gccframe.h
@@ -0,0 +1,21 @@
+/* Definition of object in frame unwind info.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define FIRST_PSEUDO_REGISTER 71
+
+#include <sysdeps/generic/gccframe.h>
diff --git a/sysdeps/csky/jmpbuf-unwind.h b/sysdeps/csky/jmpbuf-unwind.h
new file mode 100644
index 0000000..30b92d0
--- /dev/null
+++ b/sysdeps/csky/jmpbuf-unwind.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <setjmp.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
+  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj)		      \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf,						      \
+		       (void *) (_Unwind_Ptr) _Unwind_GetCFA (_context),      \
+		       _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = (uintptr_t) regs[0].__sp;
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/csky/machine-gmon.h b/sysdeps/csky/machine-gmon.h
new file mode 100644
index 0000000..1a81ef5
--- /dev/null
+++ b/sysdeps/csky/machine-gmon.h
@@ -0,0 +1,32 @@
+/* Machine-dependent definitions for profiling support.  CSKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+/* GCC for the CSKY cannot compile __builtin_return_address(N) for N != 0,
+   so we must use an assembly stub.  */
+
+/* We must not pollute the global namespace.  */
+#define mcount_internal __mcount_internal
+
+extern void mcount_internal (u_long frompc, u_long selfpc);
+#define _MCOUNT_DECL(frompc, selfpc) \
+  void mcount_internal (u_long frompc, u_long selfpc)
+
+/* Define MCOUNT as empty since we have the implementation in another file.  */
+#define MCOUNT
diff --git a/sysdeps/csky/macro.S b/sysdeps/csky/macro.S
new file mode 100644
index 0000000..c0f05ff
--- /dev/null
+++ b/sysdeps/csky/macro.S
@@ -0,0 +1,30 @@
+/* Macro defiation for string/mem operations on different cpu types
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+.macro M_BEZ rx, label
+      bez  \rx, \label
+.endm
+
+.macro M_BNEZ rx, label
+      bnez \rx, \label
+.endm
+
+.macro M_BNE rx, ry, label
+      cmpne \rx, \ry
+      bt    \label
+.endm
diff --git a/sysdeps/csky/memcpy.S b/sysdeps/csky/memcpy.S
new file mode 100644
index 0000000..9106423
--- /dev/null
+++ b/sysdeps/csky/memcpy.S
@@ -0,0 +1,400 @@
+/* The assembly function for memcpy.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+.macro	GET_FRONT_BITS rx ry
+#ifdef	__cskyLE__
+	lsr 	\rx, \ry
+#else
+	lsl 	\rx, \ry
+#endif
+.endm
+
+.macro	GET_AFTER_BITS rx ry
+#ifdef	__cskyLE__
+	lsl 	\rx, \ry
+#else
+	lsr     \rx, \ry
+#endif
+.endm
+
+ENTRY(memcpy)
+#ifndef	__CSKYABIV2__
+	/* If len less than 4 bytes */
+	mov     r7, r2
+	cmplti  r4, 4
+	jbt     .L_copy_by_byte
+
+	/* If dest is not 4 bytes aligned */
+	mov     r6, r2
+	andi    r6, 3
+	cmpnei  r6, 0
+	jbt     .L_dest_not_aligned
+	.L0:
+	mov     r6, r3
+	andi    r6, 3
+	cmpnei  r6, 0
+	/* If dest is aligned, but src is not aligned */
+	jbt     .L_dest_aligned_but_src_not_aligned
+
+	/* If dest and src are all aligned and len less than 16 bytes */
+	cmplti  r4, 16
+	jbt     .L_aligned_and_len_less_16bytes
+
+	/* src and dst are all aligned, and len > 16 bytes */
+	subi    sp, 8
+	stw     r8, (sp, 0)
+	stw     r9, (sp, 4)
+.L_aligned_and_len_larger_16bytes:
+	ldw     r1, (r3, 0)
+	ldw     r5, (r3, 4)
+	ldw     r8, (r3, 8)
+	ldw     r9, (r3, 12)
+	stw     r1, (r7, 0)
+	stw     r5, (r7, 4)
+	stw     r8, (r7, 8)
+	stw     r9, (r7, 12)
+	subi    r4, 16
+	addi    r3, 16
+	addi    r7, 16
+	cmplti  r4, 16
+	jbf     .L_aligned_and_len_larger_16bytes
+	ldw     r8, (sp, 0)
+	ldw     r9, (sp, 4)
+	addi    sp, 8
+
+.L_aligned_and_len_less_16bytes:
+	cmplti  r4, 4
+	jbt     .L_copy_by_byte
+	ldw     r1, (r3, 0)
+	stw     r1, (r7, 0)
+	subi    r4, 4
+	addi    r3, 4
+	addi    r7, 4
+	jbr     .L_aligned_and_len_less_16bytes
+
+	/* len less than 4 bytes */
+.L_copy_by_byte:
+	cmpnei  r4, 0
+	jbf     .L_return
+	ldb     r1, (r3, 0)
+	stb     r1, (r7, 0)
+	subi    r4, 1
+	addi    r3, 1
+	addi    r7, 1
+	jbr     .L_copy_by_byte
+
+.L_return:
+	rts
+
+	/* If dest is not aligned, we copy some bytes to make dest align.
+	Then we should judge whether src is aligned. */
+
+	/* consider overlapped case */
+.L_dest_not_aligned:
+	mov     r5, r3
+	rsub    r5, r5, r7
+	abs     r5, r5
+	cmplt   r5, r4
+	jbt     .L_copy_by_byte
+
+	/* Makes the dest align. */
+.L1:
+	ldb     r1, (r3, 0)
+	stb     r1, (r7, 0)
+	addi    r6, 1
+	subi    r4, 1
+	addi    r3, 1
+	addi    r7, 1
+	cmpnei  r6, 4
+	jbt     .L1
+	cmplti  r4, 4
+	jbt     .L_copy_by_byte
+	/* Judge whether the src is aligned. */
+	jbf     .L0
+
+	/* consider overlapped case */
+.L_dest_aligned_but_src_not_aligned:
+	mov     r5, r3
+	rsub    r5, r5, r7
+	abs     r5, r5
+	cmplt   r5, r4
+	jbt     .L_copy_by_byte
+
+	bclri   r3, 0
+	bclri   r3, 1
+	ldw     r1, (r3, 0)
+	addi    r3, 4
+
+	subi    sp, 16
+	stw     r11, (sp,0)
+	stw     r12, (sp,4)
+	stw     r13, (sp,8)
+	movi    r5, 8
+	/* r6 is used to store tne misaligned bits */
+	mult    r5, r6
+	mov     r12, r5
+	rsubi   r5, 31
+	addi    r5, 1
+	mov     r13, r5
+
+	cmplti  r4, 16
+	jbt     .L_not_aligned_and_len_less_16bytes
+
+	stw     r8, (sp, 12)
+	subi    sp, 8
+	stw     r9, (sp, 0)
+	stw     r10, (sp, 4)
+.L_not_aligned_and_len_larger_16bytes:
+	ldw     r5, (r3, 0)
+	ldw     r11, (r3, 4)
+	ldw     r8, (r3, 8)
+	ldw     r9, (r3, 12)
+
+	/* little or big endian? */
+	GET_FRONT_BITS r1 r12
+	mov     r10, r5
+	GET_AFTER_BITS r5 r13
+	or      r5, r1
+
+	GET_FRONT_BITS r10 r12
+	mov     r1, r11
+	GET_AFTER_BITS r11 r13
+	or      r11, r10
+
+	GET_FRONT_BITS r1 r12
+	mov     r10, r8
+	GET_AFTER_BITS r8 r13
+	or      r8, r1
+
+	GET_FRONT_BITS r10 r12
+	mov     r1, r9
+	GET_AFTER_BITS r9 r13
+	or      r9, r10
+
+	stw     r5, (r7, 0)
+	stw     r11, (r7, 4)
+	stw     r8, (r7, 8)
+	stw     r9, (r7, 12)
+	subi    r4, 16
+	addi    r3, 16
+	addi    r7, 16
+	cmplti  r4, 16
+	jbf     .L_not_aligned_and_len_larger_16bytes
+	ldw     r9, (sp, 0)
+	ldw     r10, (sp, 4)
+	addi    sp, 8
+	ldw     r8, (sp,12)
+
+.L_not_aligned_and_len_less_16bytes:
+	cmplti  r4, 4
+	jbf     .L2
+	/* r6 is used to stored the misaligned bits */
+	rsubi   r6, 4
+	/* initial the position */
+	subu    r3, r6
+	ldw     r11, (sp, 0)
+	ldw     r12, (sp, 4)
+	ldw     r13, (sp, 8)
+	addi    sp, 16
+	jbr     .L_copy_by_byte
+	.L2:
+	ldw     r5, (r3, 0)
+	GET_FRONT_BITS r1 r12
+	mov     r11, r1
+	mov     r1, r5
+	GET_AFTER_BITS r5 r13
+	or      r5, r11
+	stw     r5, (r7, 0)
+	subi    r4, 4
+	addi    r3, 4
+	addi    r7, 4
+	jbr     .L_not_aligned_and_len_less_16bytes
+
+#else /* __CSKYABIV2__ */
+	/* If len less than 4 bytes */
+	mov     r3, r0
+	cmplti  r2, 4
+	jbt     .L_copy_by_byte
+
+	mov     r12, r0
+	andi    r12, 3
+	/* If dest is not 4 bytes aligned */
+	bnez    r12, .L_dest_not_aligned
+.L0:
+	/* If dest is aligned, but src is not aligned */
+	mov     r12, r1
+	andi    r12, 3
+	bnez    r12, .L_dest_aligned_but_src_not_aligned
+
+	/* dest and src are all aligned */
+	cmplti  r2, 16
+	/* If len less than 16 bytes */
+	jbt     .L_aligned_and_len_less_16bytes
+
+	/* src and dst are all aligned, and len > 16 bytes */
+.L_aligned_and_len_larger_16bytes:
+	ldw     r18, (r1, 0)
+	ldw     r19, (r1, 4)
+	ldw     r20, (r1, 8)
+	ldw     r21, (r1, 12)
+	stw     r18, (r3, 0)
+	stw     r19, (r3, 4)
+	stw     r20, (r3, 8)
+	stw     r21, (r3, 12)
+	subi    r2, 16
+	addi    r1, 16
+	addi    r3, 16
+	cmplti  r2, 16
+	jbf     .L_aligned_and_len_larger_16bytes
+
+.L_aligned_and_len_less_16bytes:
+	cmplti  r2, 4
+	jbt     .L_copy_by_byte
+	ldw     r18, (r1, 0)
+	stw     r18, (r3, 0)
+	subi    r2, 4
+	addi    r1, 4
+	addi    r3, 4
+	jbr     .L_aligned_and_len_less_16bytes
+
+	/* len less than 4 bytes */
+.L_copy_by_byte:
+	cmpnei  r2, 0
+	jbf     .L_return
+	ldb     r18, (r1, 0)
+	stb     r18, (r3, 0)
+	subi    r2, 1
+	addi    r1, 1
+	addi    r3, 1
+	jbr     .L_copy_by_byte
+
+.L_return:
+	rts
+
+	/* If dest is not aligned, just copying some bytes makes the dest align.
+	After that, we judge whether the src is aligned. */
+
+	/* consider overlapped case */
+.L_dest_not_aligned:
+	rsub    r13, r1, r3
+	abs     r13, r13
+	cmplt   r13, r2
+	jbt     .L_copy_by_byte
+
+.L1:
+	/* makes the dest align. */
+	ldb     r18, (r1, 0)
+	stb     r18, (r3, 0)
+	addi    r12, 1
+	subi    r2, 1
+	addi    r1, 1
+	addi    r3, 1
+	cmpnei  r12, 4
+	jbt     .L1
+	cmplti  r2, 4
+	jbt     .L_copy_by_byte
+	/* judge whether the src is aligned. */
+	jbf     .L0
+
+	/* consider overlapped case */
+.L_dest_aligned_but_src_not_aligned:
+	rsub    r13, r1, r3
+	abs     r13, r13
+	cmplt   r13, r2
+	jbt     .L_copy_by_byte
+
+	bclri   r1, 0
+	bclri   r1, 1
+	ldw     r18, (r1, 0)
+	addi    r1, 4
+
+	/* r12 is used to store the misaligned bits */
+	movi    r13, 8
+	mult    r13, r12
+	mov     r24, r13
+	rsubi   r13, 32
+	mov     r25, r13
+
+	cmplti  r2, 16
+	jbt     .L_not_aligned_and_len_less_16bytes
+
+.L_not_aligned_and_len_larger_16bytes:
+	ldw     r20, (r1, 0)
+	ldw     r21, (r1, 4)
+	ldw     r22, (r1, 8)
+	ldw     r23, (r1, 12)
+
+	/* little or big endian? */
+	GET_FRONT_BITS r18 r24
+	mov     r19, r20
+	GET_AFTER_BITS r20 r25
+	or      r20, r18
+
+	GET_FRONT_BITS r19 r24
+	mov     r18, r21
+	GET_AFTER_BITS r21 r13
+	or      r21, r19
+
+	GET_FRONT_BITS r18 r24
+	mov     r19, r22
+	GET_AFTER_BITS r22 r25
+	or      r22, r18
+
+	GET_FRONT_BITS r19 r24
+	mov     r18, r23
+	GET_AFTER_BITS r23 r25
+	or      r23, r19
+
+	stw     r20, (r3, 0)
+	stw     r21, (r3, 4)
+	stw     r22, (r3, 8)
+	stw     r23, (r3, 12)
+	subi    r2, 16
+	addi    r1, 16
+	addi    r3, 16
+	cmplti  r2, 16
+	jbf     .L_not_aligned_and_len_larger_16bytes
+
+	.L_not_aligned_and_len_less_16bytes:
+	cmplti  r2, 4
+	jbf     .L2
+	/* r12 is used to stored the misaligned bits */
+	rsubi   r12, 4
+	/* initial the position */
+	subu    r1, r12
+	jbr     .L_copy_by_byte
+	.L2:
+	ldw     r21, (r1, 0)
+	GET_FRONT_BITS r18 r24
+	mov     r19, r18
+	mov     r18, r21
+	GET_AFTER_BITS r21 r25
+	or      r21, r19
+	stw     r21, (r3, 0)
+	subi    r2, 4
+	addi    r1, 4
+	addi    r3, 4
+	jbr     .L_not_aligned_and_len_less_16bytes
+
+# endif
+END(memcpy)
+
+libc_hidden_builtin_def(memcpy)
+.weak memcpy
diff --git a/sysdeps/csky/memusage.h b/sysdeps/csky/memusage.h
new file mode 100644
index 0000000..5d29e59
--- /dev/null
+++ b/sysdeps/csky/memusage.h
@@ -0,0 +1,20 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
+
+#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/csky/setjmp.S b/sysdeps/csky/setjmp.S
new file mode 100644
index 0000000..ed5e27e
--- /dev/null
+++ b/sysdeps/csky/setjmp.S
@@ -0,0 +1,113 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+ENTRY(setjmp)
+        movi    a1, 1
+        br      __sigsetjmp
+END(setjmp)
+
+ENTRY(_setjmp)
+        movi    a1, 0
+        br      __sigsetjmp
+END(_setjmp)
+
+libc_hidden_def (_setjmp)
+
+ENTRY(__sigsetjmp)
+	mov     a2, a0
+	/* Save registers */
+
+#ifdef __CSKYABIV2__
+#ifdef PTR_MANGLE
+        PTR_MANGLE(t0, sp, a3)
+	stw     t0, (a2, 0)
+        PTR_MANGLE2(t0, lr, a3)
+	stw     t0, (a2, 4)
+#else
+	stw     sp, (a2, 0)
+	stw     lr, (a2, 4)
+#endif
+	stw     r4, (a2, 8)
+	stw     r5, (a2, 12)
+	stw     r6, (a2, 16)
+	stw     r7, (a2, 20)
+	stw     r8, (a2, 24)
+	stw     r9, (a2, 28)
+	stw     r10, (a2, 32)
+	stw     r11, (a2, 36)
+	stw     r16, (a2, 40)
+	stw     r17, (a2, 44)
+	stw     r26, (a2, 48)
+	stw     r27, (a2, 52)
+	stw     r28, (a2, 56)
+	stw     r29, (a2, 60)
+	stw     r30, (a2, 64)
+	stw     r31, (a2, 68)
+	addi    a2, 72
+#else
+#ifdef PTR_MANGLE
+        mov     r6, sp
+        PTR_MANGLE(r6, r6, a3)
+        stw     r6, (a2, 0)
+        mov     r6, lr
+        PTR_MANGLE2(r6, r6, a3)
+        stw     r6, (a2, 4)
+#else
+        stw     sp, (a2, 0)
+        stw     lr, (a2, 4)
+#endif
+	stw     r8, (a2, 8)
+	stw     r9, (a2, 12)
+	stw     r10, (a2, 16)
+	stw     r11, (a2, 20)
+	stw     r12, (a2, 24)
+	stw     r13, (a2, 28)
+	stw     r14, (a2, 32)
+	addi    a2, 32
+	addi    a2, 4
+#endif
+
+#ifdef __PIC__
+# ifdef __CSKYABIV2__
+	grs     t1, .Lgetpc
+.Lgetpc:
+	lrw     t0, .Lgetpc@GOTPC
+	addu    t1, t0
+	lrw     a2, __sigjmp_save@PLT
+	ldr.w   a2, (t1, a2 << 0)
+	jmp     a2
+# else
+	mov     a3, lr
+	bsr     .Lgetpc
+.Lgetpc:
+	lrw     r7, .Lgetpc@GOTPC
+	addu    r7, lr
+	lrw     a2, __sigjmp_save@PLT
+	addu    r7, a2
+	ldw     r7, (r7)
+	mov     lr, a3
+	jmp     r7
+# endif /* !__CSKYABIV2__ */
+#else
+	jmpi    __sigjmp_save
+#endif /* !__PIC__ */
+
+END(__sigsetjmp)
+
+hidden_def (__sigsetjmp)
diff --git a/sysdeps/csky/start.S b/sysdeps/csky/start.S
new file mode 100644
index 0000000..f592c22
--- /dev/null
+++ b/sysdeps/csky/start.S
@@ -0,0 +1,133 @@
+/* Startup code compliant to the ELF C-SKY ABI.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file with other
+   programs, and to distribute those programs without any restriction
+   coming from the use of this file. (The GNU Lesser General Public
+   License restrictions do apply in other respects; for example, they
+   cover modification of the file, and distribution when not linked
+   into another program.)
+
+   Note that people who make modified versions of this file are not
+   obligated to grant this special exception for their modified
+   versions; it is their choice whether to do so. The GNU Lesser
+   General Public License gives permission to release a modified
+   version without this exception; this exception also makes it
+   possible to release a modified version which carries forward this
+   exception.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* We need to call:
+   __libc_start_main (int (*main) (int, char **, char **), int argc,
+		      char **argv, void (*init) (void), void (*fini) (void),
+		      void (*rtld_fini) (void), void *stack_end)
+*/
+
+#include <sysdep.h>
+
+.text
+	.globl _start
+	.type _start,@function
+_start:
+	/* Clear the frame pointer and link register since this is the outermost frame. */
+	movi	lr, 0
+	/* Pop argc off the stack and save a pointer to argv */
+	ldw 	a1, (sp, 0)	/* __libc_start_main(arg1): argc */
+	addi    sp, 4
+	mov 	a2, sp		/* __libc_start_main(arg1): argv */
+
+	subi	sp, 4
+	/* Push stack limit */
+	stw 	a2, (sp, 0)
+#ifdef	__CSKYABIV2__
+	/* Push rtld_fini */
+	subi	sp, 4
+	stw 	a0, (sp, 0)
+#else
+	mov	r7, a0
+#endif
+
+#ifdef SHARED
+	subi sp,8
+	stw lr,(sp,0)
+	stw gb,(sp,4)
+	bsr .Lgetpc
+.Lgetpc:
+	lrw  gb, .Lgetpc@GOTPC
+	addu gb, lr
+	lrw  a3, __libc_csu_fini@GOT
+	addu a3, gb
+	ldw  a3, (a3)
+# ifdef	__CSKYABIV2__
+	subi sp, 4
+	stw  a3, (sp,0)
+# else
+	mov  a4, a3
+# endif /* !__CSKYABIV2__ */
+	lrw  a3, __libc_csu_init@GOT
+	addu a3, gb
+	ldw  a3,(a3,0)
+# ifdef __CSKYABIV2__
+	lrw  t0, main@GOT
+	addu t0, gb
+	ldw  a0,(t0,0)
+	lrw  t1,__libc_start_main@PLT
+	addu t1, gb
+	ldw  t1, (t1, 0)
+	jsr  t1
+# else
+	lrw  a0, main@GOT
+	addu a0, gb
+	ldw  a0,(a0,0)
+	lrw  r13,__libc_start_main@PLT
+	addu r13, gb
+	ldw  r13, (r13, 0)
+	jsr  r13
+# endif /* !__CSKYABIV2__ */
+	ldw  lr,(sp,0)
+	ldw  gb,(sp,4)
+	addi sp, 8
+#else /* !SHARED */
+# ifdef	__CSKYABIV2__
+	/* Fetch address of __libc_csu_fini */
+	lrw a0, __libc_csu_fini
+	/* Push __libc_csu_fini */
+	subi sp,4
+	stw a0, (sp,0)
+# else
+	lrw a4, __libc_csu_fini
+# endif /* !__CSKYABIV2__ */
+	/* Set up the other arguments in registers */
+	lrw a0, main
+	lrw a3, __libc_csu_init
+	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+	/* Let the libc call main and exit with its return code.  */
+	jsri __libc_start_main
+#endif /* !SHARED */
+
+	/* should never get here....*/
+	jsri abort
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
diff --git a/sysdeps/csky/strcmp.S b/sysdeps/csky/strcmp.S
new file mode 100644
index 0000000..9bfe32f
--- /dev/null
+++ b/sysdeps/csky/strcmp.S
@@ -0,0 +1,336 @@
+/* The assembly function for string compare. C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#include "macro.S"
+
+ENTRY(strcmp)
+#ifndef  __CSKYABIV2__
+	mov        r6, r2
+
+	or         r2, r3
+	andi       r2, 0x3
+	cmpnei     r2, 0x0     /* d or s is aligned ?*/
+	bt         4f          /* if not aligned, goto 4f*/
+	1:                   /* if aligned, load word each time.*/
+	ldw        r2, (r6, 0)
+	ldw        r7, (r3, 0)
+	cmpne      r2, r7
+	bt         1f       /* if d[i] != s[i], goto 1f */
+	tstnbz     r2       /* if d[i] == s[i], check if d or s is at the end. */
+	bf         3f       /* if at the end, goto 3f (finish comparing) */
+
+	ldw        r2, (r6, 4)
+	ldw        r7, (r3, 4)
+	cmpne      r2, r7
+	bt         1f
+	tstnbz     r2
+	bf         3f
+
+	ldw        r2, (r6, 8)
+	ldw        r7, (r3, 8)
+	cmpne      r2, r7
+	bt         1f
+	tstnbz     r2
+	bf         3f
+
+	ldw        r2, (r6, 12)
+	ldw        r7, (r3, 12)
+	cmpne      r2, r7
+	bt         1f
+	tstnbz     r2
+	bf         3f
+
+	ldw        r2, (r6, 16)
+	ldw        r7, (r3, 16)
+	cmpne      r2, r7
+	bt         1f
+	tstnbz     r2
+	bf         3f
+
+	ldw        r2, (r6, 20)
+	ldw        r7, (r3, 20)
+	cmpne      r2, r7
+	bt         1f
+	tstnbz     r2
+	bf         3f
+
+	ldw        r2, (r6, 24)
+	ldw        r7, (r3, 24)
+	cmpne      r2, r7
+	bt         1f
+	tstnbz     r2
+	bf         3f
+
+	ldw        r2, (r6, 28)
+	ldw        r7, (r3, 28)
+	cmpne      r2, r7
+	bt         1f
+	tstnbz     r2
+	bf         3f
+
+	addi       r6, 32
+	addi       r3, 32
+	br         1b
+
+#ifdef __CSKYBE__
+	/* d[i] != s[i] in word, so we check byte 0 ? */
+1:
+	xtrb0      r1, r2
+	mov        r4, r1
+	xtrb0      r1, r7
+	cmpne      r4, r1
+	bt         2f
+	cmpnei     r4, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb1      r1, r2
+	mov        r4, r1
+	xtrb1      r1, r7
+	cmpne      r4, r1
+	bt         2f
+	cmpnei     r4, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb2      r1, r2
+	mov        r4, r1
+	xtrb2      r1, r7
+	cmpne      r4, r1
+	bt         2f
+	cmpnei     r4, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb3      r1, r2
+	mov        r4, r1
+	xtrb3      r1, r7
+
+#else /* little endian */
+	/* d[i] != s[i] in word, so we check byte 0 ? */
+1:
+	xtrb3      r1, r2
+	mov        r4, r1
+	xtrb3      r1, r7
+	cmpne      r4, r1
+	bt         2f
+	cmpnei     r4, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb2      r1, r2
+	mov        r4, r1
+	xtrb2      r1, r7
+	cmpne      r4, r1
+	bt         2f
+	cmpnei     r4, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb1      r1, r2
+	mov        r4, r1
+	xtrb1      r1, r7
+	cmpne      r4, r1
+	bt         2f
+	cmpnei     r4, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb0      r1, r2
+	mov        r4, r1
+	xtrb0      r1, r7
+
+#endif
+	/* get the result when d[i] != s[i] */
+2:
+	subu       r4, r1
+	mov        r2, r4
+	jmp        r15
+
+	/* return when d[i] == s[i] */
+3:
+	subu       r2, r7
+	jmp        r15
+
+	/* cmp when d or s is not aligned */
+4:
+	ldb       r2, (r6,0)
+	ldb       r7, (r3, 0)
+	cmpne     r2, r7
+	bt        3b
+	addi      r3, 1
+	addi      r6, 1
+	cmpnei    r2, 0
+	bt        4b
+	jmp       r15
+# else /* __CSKYABIV2__ */
+	mov        a3, a0
+
+	or         a0, a1
+	andi       a0, 0x3
+	M_BNEZ     a0, 4f
+	1:
+	/* if aligned, load word each time. */
+	ldw        a0, (a3, 0)
+	ldw        t0, (a1, 0)
+	/* if d[i] != s[i], goto 1f */
+	M_BNE      a0, t0, 1f
+	/* if d[i] == s[i], check if d or s is at the end. */
+	tstnbz     a0
+	/* if at the end, goto 3f (finish comparing) */
+	bf         3f
+#if defined ( __ck802__ )
+	addi       a3, 4
+	addi       a1, 4
+#else
+	ldw        a0, (a3, 4)
+	ldw        t0, (a1, 4)
+	M_BNE      a0, t0, 1f
+	tstnbz     a0
+	bf         3f
+
+	ldw        a0, (a3, 8)
+	ldw        t0, (a1, 8)
+	M_BNE      a0, t0, 1f
+	tstnbz     a0
+	bf         3f
+
+	ldw        a0, (a3, 12)
+	ldw        t0, (a1, 12)
+	M_BNE      a0, t0, 1f
+	tstnbz     a0
+	bf         3f
+
+	ldw        a0, (a3, 16)
+	ldw        t0, (a1, 16)
+	M_BNE      a0, t0, 1f
+	tstnbz     a0
+	bf         3f
+
+	ldw        a0, (a3, 20)
+	ldw        t0, (a1, 20)
+	M_BNE      a0, t0, 1f
+	tstnbz     a0
+	bf         3f
+
+	ldw        a0, (a3, 24)
+	ldw        t0, (a1, 24)
+	M_BNE      a0, t0, 1f
+	tstnbz     a0
+	bf         3f
+
+	ldw        a0, (a3, 28)
+	ldw        t0, (a1, 28)
+	M_BNE      a0, t0, 1f
+	tstnbz     a0
+	bf         3f
+
+	addi       a3, 32
+	addi       a1, 32
+#endif
+	br         1b
+
+# ifdef __CSKYBE__
+	/* d[i] != s[i] in word, so we check byte 0 ? */
+1:
+	xtrb0      t1, a0
+	mov        a2, t1
+	xtrb0      t1, t0
+	M_BNE      a2, t1, 2f
+	cmpnei     a2, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb1      t1, a0
+	mov        a2, t1
+	xtrb1      t1, t0
+	M_BNE      a2, t1, 2f
+	cmpnei     a2, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb2      t1, a0
+	mov        a2, t1
+	xtrb2      t1, t0
+	M_BNE      a2, t1, 2f
+	cmpnei     a2, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb3      t1, a0
+	mov        a2, t1
+	xtrb3      t1, t0
+
+# else /* !__CSKYBE__ */
+	/* d[i] != s[i] in word, so we check byte 0 ? */
+1:
+	xtrb3      t1, a0
+	mov        a2, t1
+	xtrb3      t1, t0
+	M_BNE      a2, t1, 2f
+	cmpnei     a2, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb2      t1, a0
+	mov        a2, t1
+	xtrb2      t1, t0
+	M_BNE      a2, t1, 2f
+	cmpnei     a2, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb1      t1, a0
+	mov        a2, t1
+	xtrb1      t1, t0
+	M_BNE      a2, t1, 2f
+	cmpnei     a2, 0
+	bf         2f
+
+	/* d[i] != s[i] in word, so we check byte 1 ? */
+	xtrb0      t1, a0
+	mov        a2, t1
+	xtrb0      t1, t0
+
+# endif /* !__CSKYBE__ */
+	/* get the result when d[i] != s[i] */
+2:
+	subu       a2, t1
+	mov        a0, a2
+	jmp        r15
+
+	/* return when d[i] == s[i] */
+3:
+	subu       a0, t0
+	jmp        r15
+
+	/* cmp when d or s is not aligned */
+4:
+	ldb       a0, (a3,0)
+	ldb       t0, (a1, 0)
+	M_BNE     a0, t0, 3b
+	addi      a1, 1
+	addi      a3, 1
+	M_BNEZ    a0, 4b
+	jmp        r15
+#endif /* __CSKYABIV2__ */
+END(strcmp)
+
+libc_hidden_def(strcmp)
+.weak strcmp
diff --git a/sysdeps/csky/strcpy.S b/sysdeps/csky/strcpy.S
new file mode 100644
index 0000000..e757aeb
--- /dev/null
+++ b/sysdeps/csky/strcpy.S
@@ -0,0 +1,273 @@
+/* The assembly function for string copy.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#include "macro.S"
+
+ENTRY(strcpy)
+#ifndef  __CSKYABIV2__
+	mov     r6, r2
+	mov     r7, r3
+	or      r7, r6
+	andi    r7, 3
+	cmpnei  r7, 0
+	bf      2f
+1:
+	ldb     r5, (r3)
+	stb     r5, (r6)
+	addi    r3, 1
+	addi    r6, 1
+	cmpnei  r5, 0
+	bt      1b
+1:
+	jmp     r15
+
+2:
+	ldw     r5, (r3)
+	tstnbz  r5
+	bf      10f
+	stw     r5, (r6)
+
+	ldw     r5, (r3, 4)
+	tstnbz  r5
+	bf      3f
+	stw     r5, (r6, 4)
+
+	ldw     r5, (r3, 8)
+	tstnbz  r5
+	bf      4f
+	stw     r5, (r6, 8)
+
+	ldw     r5, (r3, 12)
+	tstnbz  r5
+	bf      5f
+	stw     r5, (r6, 12)
+
+	ldw     r5, (r3, 16)
+	tstnbz  r5
+	bf      6f
+	stw     r5, (r6, 16)
+
+	ldw     r5, (r3, 20)
+	tstnbz  r5
+	bf      7f
+	stw     r5, (r6, 20)
+
+	ldw     r5, (r3, 24)
+	tstnbz  r5
+	bf      8f
+	stw     r5, (r6, 24)
+
+	ldw     r5, (r3, 28)
+	tstnbz  r5
+	bf      9f
+	stw     r5, (r6, 28)
+
+	addi    r6, 32
+	addi    r3, 32
+	br      2b
+
+3:
+	addi    r6, 4
+	br      10f
+
+4:
+	addi    r6, 8
+	br      10f
+
+5:
+	addi    r6, 12
+	br      10f
+
+6:
+	addi    r6, 16
+	br      10f
+
+7:
+	addi    r6, 20
+	br      10f
+
+8:
+	addi    r6, 24
+	br      10f
+
+9:
+	addi    r6, 28
+
+10:
+# ifdef __CSKYBE__
+	xtrb0   r1, r5
+	stb     r1, (r6)
+	cmpnei  r1, 0
+	bf      5f
+	xtrb1   r1, r5
+	stb     r1, (r6, 1)
+	cmpnei  r1, 0
+	bf      5f
+	xtrb2   r1, r5
+	stb     r1, (r6, 2 )
+	cmpnei  r1, 0
+	bf      5f
+	stw     r5, (r6)
+
+# else /* !__CSKYBE__ */
+	xtrb3   r1, r5
+	stb     r1, (r6)
+	cmpnei  r1, 0
+	bf      5f
+	xtrb2   r1, r5
+	stb     r1, (r6, 1)
+	cmpnei  r1, 0
+	bf      5f
+	xtrb1   r1, r5
+	stb     r1, (r6, 2)
+	cmpnei  r1, 0
+	bf      5f
+	stw     r5, (r6)
+# endif /* !__CSKYBE__ */
+5:
+	jmp     r15
+#else /* __CSKYABIV2__ */
+	mov     a3, a0
+	or      a2, a1, a3
+	andi    t0, a2, 3
+	M_BEZ   t0, 2f
+	mov     t0, a1
+1:
+	ld.b    a2, (t0)
+	stb     a2, (a3)
+	addi    t0, t0, 1
+	addi    a3, a3, 1
+	M_BNEZ  a2, 1b
+
+	jmp     r15
+
+2:
+# if defined (__ck802__)
+	ldw     a2, (a1)
+	tstnbz  a2
+	bf      11f
+	stw     a2, (a3)
+	addi    a3, 4
+	addi    a1, 4
+	br      2b
+# else /* !__ck802__ */
+	ldw     a2, (a1)
+	tstnbz  a2
+	bf      11f
+	stw     a2, (a3)
+
+	ldw     a2, (a1, 4)
+	tstnbz  a2
+	bf      4f
+	stw     a2, (a3, 4)
+
+	ldw     a2, (a1, 8)
+	tstnbz  a2
+	bf      5f
+	stw     a2, (a3, 8)
+
+	ldw     a2, (a1, 12)
+	tstnbz  a2
+	bf      6f
+	stw     a2, (a3, 12)
+
+	ldw     a2, (a1, 16)
+	tstnbz  a2
+	bf      7f
+	stw     a2, (a3, 16)
+
+	ldw     a2, (a1, 20)
+	tstnbz  a2
+	bf      8f
+	stw     a2, (a3, 20)
+
+	ldw     a2, (a1, 24)
+	tstnbz  a2
+	bf      9f
+	stw     a2, (a3, 24)
+
+	ldw     a2, (a1, 28)
+	tstnbz  a2
+	bf      10f
+	stw     a2, (a3, 28)
+
+	addi     a3, 32
+	addi     a1, 32
+	br       2b
+
+
+4:
+	addi    a3, 4
+	br      11f
+
+5:
+	addi    a3, 8
+	br      11f
+
+6:
+	addi    a3, 12
+	br      11f
+
+7:
+	addi    a3, 16
+	br      11f
+
+8:
+	addi    a3, 20
+	br      11f
+
+9:
+	addi    a3, 24
+	br      11f
+
+10:
+	addi    a3, 28
+# endif /* !__ck802__ */
+11:
+# ifdef __CSKYBE__
+	xtrb0   t0, a2
+	st.b    t0, (a3)
+	M_BEZ   t0, 5f
+	xtrb1   t0, a2
+	st.b    t0, (a3, 1)
+	M_BEZ   t0, 5f
+	xtrb2   t0, a2
+	st.b    t0, (a3, 2 )
+	M_BEZ   t0, 5f
+	stw     a2, (a3)
+# else
+	xtrb3   t0, a2
+	st.b    t0, (a3)
+	M_BEZ   t0, 5f
+	xtrb2   t0, a2
+	st.b    t0, (a3, 1)
+	M_BEZ   t0, 5f
+	xtrb1   t0, a2
+	st.b    t0, (a3, 2)
+	M_BEZ   t0, 5f
+	stw     a2, (a3)
+# endif /* !__CSKYBE__ */
+5:
+	jmp     r15
+
+#endif /* !__CSKYABIV2__ */
+END(strcpy)
+
+libc_hidden_def(strcpy)
+.weak strcpy
diff --git a/sysdeps/csky/sys/ucontext.h b/sysdeps/csky/sys/ucontext.h
new file mode 100644
index 0000000..fd06308
--- /dev/null
+++ b/sysdeps/csky/sys/ucontext.h
@@ -0,0 +1,116 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* System V/ckcore ABI compliant context switching support.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+#include <bits/types/sigset_t.h>
+#include <bits/types/stack_t.h>
+
+/* Type for general register.  */
+typedef int greg_t;
+
+/* Number of general registers.  */
+#if (__CSKY__ == 2)
+#define NGREG	34
+#else
+#define NGREG	18
+#endif
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  R_R0 = 0,
+#define R_R0	R_R0
+  R_R1 = 1,
+#define R_R1	R_R1
+  R_R2 = 2,
+#define R_R2	R_R2
+  R_R3 = 3,
+#define R_R3	R_R3
+  R_R4 = 4,
+#define R_R4	R_R4
+  R_R5 = 5,
+#define R_R5	R_R5
+  R_R6 = 6,
+#define R_R6	R_R6
+  R_R7 = 7,
+#define R8R7	R_R7
+  R_R8 = 8,
+#define R_R8	R_R8
+  R_R9 = 9,
+#define R_R9	R_R9
+  R_R10 = 10,
+#define R_R10	R_R10
+  R_R11 = 11,
+#define R_R11	R_R11
+  R_R12 = 12,
+#define R_R12	R_R12
+  R_R13 = 13,
+#define R_R13	R_R13
+  R_R14 = 14,
+#define R_R14	R_R14
+  R_R15 = 15,
+#define R_R15	R_R15
+#if (__CSKY__ == 2)
+  R_SR = 32,
+#define R_SR	R_SR
+  R_PC = 33,
+#define R_PC	R_PC
+#else
+  R_SR = 16,
+#define R_SR    R_SR
+  R_PC = 17,
+#define R_PC    R_PC
+#endif
+};
+
+/* Structure to describe FPU registers.  */
+typedef struct fpregset
+{
+  unsigned long  fesr;        /* fpu exception status reg */
+  unsigned long  fsr;         /* fpu status reg, nothing in CPU_CSKYV2 */
+  unsigned long  fp[32];      /* fpu general regs */
+} fpregset_t;
+
+/* Context to describe whole processor state.  */
+typedef struct
+{
+  gregset_t gregs;
+  fpregset_t fpregs;
+} mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+{
+  unsigned long int uc_flags;
+  struct ucontext *uc_link;
+  __sigset_t uc_sigmask;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;	/* struct sigcontext */
+  long int uc_filler[201];
+} ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/csky/sysdep.h b/sysdeps/csky/sysdep.h
new file mode 100644
index 0000000..527fc57
--- /dev/null
+++ b/sysdeps/csky/sysdep.h
@@ -0,0 +1,45 @@
+/* Assembler macros for C-SKY.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/generic/sysdep.h>
+#include <features.h>
+
+#ifndef __CSKYABIV2__
+# define CSKY_ABIV1
+#else
+# define CSKY_ABIV2
+#endif
+
+#ifdef __ASSEMBLER__
+
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+/* Define an entry point visible from C.  */
+#define ENTRY(name)	\
+  .globl name;		\
+  .type name,@function;	\
+  .align 4;		\
+  name##:;		\
+  cfi_startproc;	\
+
+#undef  END
+#define END(name)	\
+  cfi_endproc;		\
+  ASM_SIZE_DIRECTIVE(name)
+
+#endif
diff --git a/sysdeps/csky/tls-macros.h b/sysdeps/csky/tls-macros.h
new file mode 100644
index 0000000..3e9976b
--- /dev/null
+++ b/sysdeps/csky/tls-macros.h
@@ -0,0 +1,106 @@
+/* Macros for accessing thread-local storage.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __CSKYABIV2__
+# define TLS_LE(x)					\
+  ({ int *__result;					\
+     extern void * __read_tp (void);			\
+     void *tp = __read_tp ();				\
+     __asm__ ("lrw %0, " #x "@TPOFF; "			\
+	  "add %0, %1, %0; "				\
+	  : "=&r" (__result) : "r" (tp));		\
+     __result; })
+
+# define TLS_IE(x)					\
+  ({ int *__result;					\
+     extern void * __read_tp (void);			\
+     void *tp = __read_tp ();				\
+     __asm__ ("grs a1, 1f;"				\
+      "1: lrw %0, " #x "@GOTTPOFF;"			\
+	  "ldr.w %0, (a1, %0 << 0);"			\
+	  "add %0, %1, %0; "				\
+	  : "=&r" (__result): "r" (tp) : "a1" );	\
+     __result; })
+
+# define TLS_LD(x)					\
+  ({ char *__result;					\
+     int __offset;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("grs a1, 1f;"				\
+      "1: lrw %0, " #x "@TLSLDM32;"			\
+	  "add %0, a1, %0; "				\
+	  : "=r" (__result) : : "a1");			\
+     __result = (char *)__tls_get_addr (__result);	\
+     __asm__ ("lrw %0, " #x "@TLSLDO32; "		\
+	  : "=r" (__offset));				\
+     (int *) (__result + __offset); })
+
+# define TLS_GD(x)					\
+  ({ int *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("grs a1, 1f;"				\
+      "1: lrw %0, " #x "@TLSGD32; "			\
+	  "add %0, a1, %0; "				\
+	  : "=r" (__result) : : "a1" );			\
+     (int *)__tls_get_addr (__result); })
+
+#else
+# define TLS_LE(x)					\
+  ({ int *__result;					\
+     extern void * __read_tp (void);			\
+     void *tp = __read_tp ();				\
+     __asm__ ("lrw %0, " #x "@TPOFF\n\t "		\
+	  "add %0, %1\n\t"				\
+	  : "=&r" (__result) : "r" (tp));		\
+     __result; })
+
+# define TLS_IE(x)					\
+  ({ int *__result;					\
+     extern void * __read_tp (void);			\
+     void *tp = __read_tp ();				\
+     __asm__ ("bsr 1f\n\t"				\
+	"1: lrw %0, " #x "@GOTTPOFF\n\t"		\
+	"add	%0, r15\n\t"				\
+	"ldw 	%0, (%0, 0)\n\t"			\
+	"add	%0, %1\n\t"				\
+	  : "=&r" (__result): "r" (tp) : "r15" );	\
+     __result; })
+
+# define TLS_LD(x)					\
+  ({ char *__result;					\
+     int __offset;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("bsr 1f\n\t"				\
+      "1: lrw %0, " #x "@TLSLDM32\n\t"			\
+	  "add %0, r15\n\t"				\
+	  : "=r" (__result) : : "r15");			\
+     __result = (char *)__tls_get_addr (__result);	\
+     __asm__ ("lrw %0, " #x "@TLSLDO32\n\t "		\
+	  : "=r" (__offset));				\
+     (int *) (__result + __offset); })
+
+# define TLS_GD(x)					\
+  ({ int *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("bsr 1f;"					\
+      "1: lrw %0, " #x "@TLSGD32\n\t "			\
+	  "add %0, r15\n\t"				\
+	  : "=r" (__result) : : "r15" );		\
+     (int *)__tls_get_addr (__result); })
+
+#endif
diff --git a/sysdeps/unix/csky/abiv2_sysdep.S b/sysdeps/unix/csky/abiv2_sysdep.S
new file mode 100644
index 0000000..33cc2e8
--- /dev/null
+++ b/sysdeps/unix/csky/abiv2_sysdep.S
@@ -0,0 +1,63 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#define _ERRNO_H
+#include <bits/errno.h>
+#include <csky_readtp.h>
+
+#if !IS_IN (rtld)
+#include <dl-sysdep.h>			/* Defines RTLD_PRIVATE_ERRNO.  */
+#endif
+
+#include <tls.h>
+
+#undef syscall_error
+__syscall_error:
+#if !IS_IN (rtld)
+	mov	a1, a0
+	csky_read_tp
+
+	grs	t1, .Lgetpc1
+.Lgetpc1:
+	lrw	t0, errno@gottpoff
+	add	t1, t1, t0
+	ldw	t1, (t1)
+	add	t1, a0
+	stw	a1, (t1)
+	bmaski	a0, 0
+	jsr	r15
+#elif RTLD_PRIVATE_ERRNO
+#ifdef	__PIC__
+	grs	t1, .Lgetpc2
+.Lgetpc2:
+	lrw	t0, .Lgetpc2@GOTPC
+	addu	t1, t1, t0
+	lrw	t0, rtld_errno@PLT
+	ldr.w	t0, (t1, t0 << 0)
+#else
+	lrw	t0, rtld_errno
+#endif
+	stw	a0, (t0)
+	bmaski	a0, 0
+	jsr	r15
+#else
+#error "Unsupported non-TLS case"
+#endif
+
+#undef	__syscall_error
+END (__syscall_error)
diff --git a/sysdeps/unix/csky/sysdep.S b/sysdeps/unix/csky/sysdep.S
new file mode 100644
index 0000000..520bf59
--- /dev/null
+++ b/sysdeps/unix/csky/sysdep.S
@@ -0,0 +1,74 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef	__CSKYABIV2__
+#include "abiv2_sysdep.S"
+#else
+
+#include <sysdep.h>
+#define _ERRNO_H
+#include <bits/errno.h>
+#include <csky_readtp.h>
+
+#if IS_IN (rtld)
+#include <dl-sysdep.h>			/* Defines RTLD_PRIVATE_ERRNO.  */
+#endif
+
+#include <tls.h>
+
+#undef syscall_error
+__syscall_error:
+#if !IS_IN (rtld)
+#ifdef __PIC__
+	mov	r7, r15
+	mov	r1, r2
+	csky_read_tp
+
+	bsr	.Lgetpc1
+.Lgetpc1:
+	lrw	r5, errno@gottpoff
+	add	r5, r15
+	ldw	r5, (r5)
+	add	r5, r2
+	stw	r1, (r5)
+	bmaski  r2, 0
+	jsr	r7
+#endif
+#elif RTLD_PRIVATE_ERRNO
+#ifdef __PIC__
+	mov	r7, r15
+	bsr	.Lgetpc2
+.Lgetpc2:
+	lrw	r6, .Lgetpc2@GOTPC
+	addu	r6, r15
+	lrw	r5, rtld_errno@PLT
+	addu	r5, r6
+	ldw	r5, (r5)
+#else
+	lrw	r5, rtld_errno
+#endif
+	stw	r2, (r5)
+	bmaski	r2, 0
+	jsr	r7
+#else
+#error "Unsupported non-TLS case"
+#endif
+
+#undef __syscall_error
+END (__syscall_error)
+
+#endif	/* __CSKYABIV2__*/
diff --git a/sysdeps/unix/csky/sysdep.h b/sysdeps/unix/csky/sysdep.h
new file mode 100644
index 0000000..fb13f3d
--- /dev/null
+++ b/sysdeps/unix/csky/sysdep.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/csky/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#define ret \
+	jmp	r15;
+
+#endif
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 05/10] C-SKY: Atomic and Locking Routines
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (2 preceding siblings ...)
  2018-04-08  7:03 ` [RFC PATCH V2 09/10] C-SKY: Linux Startup and Dynamic Loading Code Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-08  7:03 ` [RFC PATCH V2 08/10] C-SKY: Build Infastructure Mao Han
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

This patch implements various atomic and locking routines on C-SKY.

        * sysdeps/csky/atomic-machine.h: New file
        * sysdeps/csky/nptl/bits/pthreadtypes-arch.h: New file
        * sysdeps/csky/nptl/bits/semaphore.h: New file
---
 sysdeps/csky/atomic-machine.h              | 114 +++++++++++++++++++++++++++++
 sysdeps/csky/nptl/bits/pthreadtypes-arch.h |  71 ++++++++++++++++++
 sysdeps/csky/nptl/bits/semaphore.h         |  34 +++++++++
 3 files changed, 219 insertions(+)
 create mode 100644 sysdeps/csky/atomic-machine.h
 create mode 100644 sysdeps/csky/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/csky/nptl/bits/semaphore.h

diff --git a/sysdeps/csky/atomic-machine.h b/sysdeps/csky/atomic-machine.h
new file mode 100644
index 0000000..97f1d9a
--- /dev/null
+++ b/sysdeps/csky/atomic-machine.h
@@ -0,0 +1,114 @@
+/* Atomic operations.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef __CSKY_ATOMIC_H_
+#define __CSKY_ATOMIC_H_
+
+#include <stdint.h>
+
+typedef int8_t atomic8_t;
+typedef uint8_t uatomic8_t;
+typedef int_fast8_t atomic_fast8_t;
+typedef uint_fast8_t uatomic_fast8_t;
+
+typedef int16_t atomic16_t;
+typedef uint16_t uatomic16_t;
+typedef int_fast16_t atomic_fast16_t;
+typedef uint_fast16_t uatomic_fast16_t;
+
+typedef int32_t atomic32_t;
+typedef uint32_t uatomic32_t;
+typedef int_fast32_t atomic_fast32_t;
+typedef uint_fast32_t uatomic_fast32_t;
+
+typedef int64_t atomic64_t;
+typedef uint64_t uatomic64_t;
+typedef int_fast64_t atomic_fast64_t;
+typedef uint_fast64_t uatomic_fast64_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+#define ATOMIC_EXCHANGE_USES_CAS 0
+
+# define __arch_compare_and_exchange_bool_8_int(mem, newval, oldval)	\
+  (abort (), 0)
+
+# define __arch_compare_and_exchange_bool_16_int(mem, newval, oldval)	\
+  (abort (), 0)
+
+# define __arch_compare_and_exchange_bool_32_int(mem, newval, oldval)	\
+  ({ __typeof (mem) _mem = (mem);					\
+    __typeof (oldval) _oldval = oldval;					\
+    __typeof (newval) _newval = newval;					\
+    register int _a0 asm ("a0") = (int)_oldval;				\
+    register int _a1 asm ("a1") = (int)_newval;				\
+    register int _a2 asm ("a2") = (int)_mem;				\
+    __asm__ __volatile__ ("trap   2\n"					\
+     : "+r" (_a0) : "r" (_a1) , "r" (_a2)				\
+     : "a3", "memory");							\
+    (int) _a0; })
+
+# define __arch_compare_and_exchange_bool_64_int(mem, newval, oldval)	\
+  (abort (), 0)
+
+# define __arch_compare_and_exchange_val_8_int(mem, newval, oldval)	\
+	(abort (), (__typeof (*mem))0)
+
+# define __arch_compare_and_exchange_val_16_int(mem, newval, oldval)	\
+	(abort (), (__typeof (*mem))0)
+
+# define __arch_compare_and_exchange_val_32_int(mem, newval, oldval)	\
+  ({ __typeof (mem) _mem = (mem);					\
+    __typeof (*mem) __gret = *_mem;					\
+    unsigned int _tmp = 0;						\
+    __typeof (oldval) _oldval = oldval;					\
+    __typeof (newval) _newval = newval;					\
+    register int _a0 asm ("a0") = (int)_oldval;				\
+    register int _a1 asm ("a1") = (int)_newval;				\
+    register int _a2 asm ("a2") = (int)_mem;				\
+	__asm__ __volatile__ ("1:\n"					\
+      "ldw      %1, (%4, 0x0)\n"					\
+      "cmpne    %1, %0\n"						\
+      "bt       2f\n"							\
+      "mov      %2, %0\n"						\
+      "trap     2\n"							\
+      "cmpnei   %0, 0\n"						\
+      "mov      %0, %2\n"						\
+      "bt       1b\n"							\
+      "2:         \n"							\
+     :"+r" (_a0), "+r"(__gret), "+r" (_tmp) :"r" (_a1) , "r" (_a2)	\
+     : "a3", "memory");							\
+    __gret; })
+
+# define __arch_compare_and_exchange_val_64_int(mem, newval, oldval)	\
+	(abort (), (__typeof (*mem))0)
+
+# define atomic_compare_and_exchange_bool_acq(mem, new, old)		\
+  __atomic_bool_bysize (__arch_compare_and_exchange_bool, int,		\
+            mem, new, old)
+
+# define atomic_compare_and_exchange_val_acq(mem, new, old)		\
+  __atomic_val_bysize (__arch_compare_and_exchange_val, int,		\
+               mem, new, old)
+
+#endif
diff --git a/sysdeps/csky/nptl/bits/pthreadtypes-arch.h b/sysdeps/csky/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..b029243
--- /dev/null
+++ b/sysdeps/csky/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,71 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.h>
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 32
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
+#define __PTHREAD_MUTEX_USE_UNION          1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#endif
+  int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif
diff --git a/sysdeps/csky/nptl/bits/semaphore.h b/sysdeps/csky/nptl/bits/semaphore.h
new file mode 100644
index 0000000..2cd4014
--- /dev/null
+++ b/sysdeps/csky/nptl/bits/semaphore.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SEMAPHORE_H
+# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead."
+#endif
+
+
+#define __SIZEOF_SEM_T	16
+
+
+/* Value returned if `sem_open' failed.  */
+#define SEM_FAILED	((sem_t *) 0)
+
+
+typedef union
+{
+  char __size[__SIZEOF_SEM_T];
+  long int __align;
+} sem_t;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 02/10] C-SKY: TLS support
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (7 preceding siblings ...)
  2018-04-08  7:03 ` [RFC PATCH V2 04/10] C-SKY: Hard Float Support Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-17 20:50   ` Joseph Myers
  2018-04-08  7:04 ` [RFC PATCH V2 10/10] C-SKY: Linux ABI Mao Han
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

This patch implements TLS support for C-SKY. We support all four
standard TLS addressing modes (LE, IE, LD, and GD) when running on
Linux via NPTL.

        * sysdeps/csky/dl-tls.h: New file
        * sysdeps/csky/libc-tls.c: New file
        * sysdeps/csky/nptl/tcb-offsets.sym: New file
        * sysdeps/csky/nptl/tls.h: New file
        * sysdeps/csky/stackinfo.h: New file
---
 sysdeps/csky/dl-tls.h             |  26 ++++++
 sysdeps/csky/libc-tls.c           |  32 +++++++
 sysdeps/csky/nptl/tcb-offsets.sym |  11 +++
 sysdeps/csky/nptl/tls.h           | 179 ++++++++++++++++++++++++++++++++++++++
 sysdeps/csky/stackinfo.h          |  32 +++++++
 5 files changed, 280 insertions(+)
 create mode 100644 sysdeps/csky/dl-tls.h
 create mode 100644 sysdeps/csky/libc-tls.c
 create mode 100644 sysdeps/csky/nptl/tcb-offsets.sym
 create mode 100644 sysdeps/csky/nptl/tls.h
 create mode 100644 sysdeps/csky/stackinfo.h

diff --git a/sysdeps/csky/dl-tls.h b/sysdeps/csky/dl-tls.h
new file mode 100644
index 0000000..d44fc18
--- /dev/null
+++ b/sysdeps/csky/dl-tls.h
@@ -0,0 +1,26 @@
+/* Thread-local storage handling in the ELF dynamic linker.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Type used for the representation of TLS information in the GOT.  */
+typedef struct
+{
+  unsigned long int ti_module;
+  unsigned long int ti_offset;
+} tls_index;
+
+extern void *__tls_get_addr (tls_index *ti);
diff --git a/sysdeps/csky/libc-tls.c b/sysdeps/csky/libc-tls.c
new file mode 100644
index 0000000..30baf62
--- /dev/null
+++ b/sysdeps/csky/libc-tls.c
@@ -0,0 +1,32 @@
+/* Thread-local storage handling in the ELF dynamic linker.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <csu/libc-tls.c>
+#include <dl-tls.h>
+
+/* On C-SKY, linker optimizations are not required, so __tls_get_addr
+   can be called even in statically linked binaries.  In this case module
+   must be always 1 and PT_TLS segment exist in the binary, otherwise it
+   would not link.  */
+
+void *
+__tls_get_addr (tls_index *ti)
+{
+  dtv_t *dtv = THREAD_DTV ();
+  return (char *) dtv[1].pointer.val + ti->ti_offset;
+}
diff --git a/sysdeps/csky/nptl/tcb-offsets.sym b/sysdeps/csky/nptl/tcb-offsets.sym
new file mode 100644
index 0000000..8da750b
--- /dev/null
+++ b/sysdeps/csky/nptl/tcb-offsets.sym
@@ -0,0 +1,11 @@
+#include <sysdep.h>
+#include <tls.h>
+
+--
+
+-- Derive offsets relative to the thread register.
+#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - sizeof(struct pthread))
+
+MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
+TID_OFFSET			thread_offsetof (tid)
+POINTER_GUARD                   offsetof (tcbhead_t, pointer_guard)
diff --git a/sysdeps/csky/nptl/tls.h b/sysdeps/csky/nptl/tls.h
new file mode 100644
index 0000000..7b490c2
--- /dev/null
+++ b/sysdeps/csky/nptl/tls.h
@@ -0,0 +1,179 @@
+/* Definitions for thread-local data handling.  NPTL/csky version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TLS_H
+#define _TLS_H 1
+
+#ifndef __ASSEMBLER__
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <dl-dtv.h>
+
+#ifdef __CSKYABIV2__
+/* define r31 as thread pointer register. */
+#define READ_THREAD_POINTER() \
+    ({ void *__result;						\
+       __asm__ __volatile__ ("mov %0, r31"			\
+                             : "=r" (__result));		\
+       __result; })
+#else
+#define READ_THREAD_POINTER() \
+    ({ register unsigned int __result __asm__("a0");		\
+       __asm__ __volatile__ ("trap 3;"				\
+                             : "=r" (__result) : : );		\
+       __result; })
+#endif
+
+#else /* __ASSEMBLER__ */
+#include <tcb-offsets.h>
+#ifdef __CSKYABIV2__
+/* define r31 as thread pointer register. */
+#define READ_THREAD_POINTER() \
+       mov r0, r31;
+#else
+#define READ_THREAD_POINTER() \
+       trap 3;
+#endif
+#endif /* __ASSEMBLER__ */
+
+#ifndef __ASSEMBLER__
+
+/* Get system call information.  */
+#include <sysdep.h>
+
+/* The TP points to the start of the thread blocks.  */
+#define TLS_DTV_AT_TP	1
+#define TLS_TCB_AT_TP	0
+
+/* Get the thread descriptor definition.  */
+#include <nptl/descr.h>
+
+typedef struct
+{
+  dtv_t *dtv;
+  void *private;
+  uintptr_t pointer_guard;
+} tcbhead_t;
+
+/* This is the size of the initial TCB.  */
+#define TLS_INIT_TCB_SIZE	sizeof (tcbhead_t)
+
+/* Alignment requirements for the initial TCB.  */
+#define TLS_INIT_TCB_ALIGN	8
+
+/* This is the size of the TCB.  */
+#define TLS_TCB_SIZE		sizeof (tcbhead_t)
+
+/* Alignment requirements for the TCB.  */
+#define TLS_TCB_ALIGN		8
+
+/* This is the size we need before TCB.  */
+#define TLS_PRE_TCB_SIZE	sizeof (struct pthread)
+
+/* The thread pointer tp points to the end of the TCB.
+   The pthread_descr structure is immediately in front of the TCB.  */
+#define TLS_TCB_OFFSET		0
+
+/* Install the dtv pointer.  The pointer passed is to the element with
+   index -1 which contain the length.  */
+#define INSTALL_DTV(tcbp, dtvp) \
+  (((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1)
+
+/* Install new dtv for current thread.  */
+#define INSTALL_NEW_DTV(dtv) \
+  (THREAD_DTV() = (dtv))
+
+/* Return dtv of given thread descriptor.  */
+#define GET_DTV(tcbp) \
+  (((tcbhead_t *) (tcbp))->dtv)
+
+#define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd) + 1
+
+/* Code to initially initialize the thread pointer.  This might need
+   special attention since 'errno' is not yet available and if the
+   operation can cause a failure 'errno' must not be touched.  */
+#define TLS_INIT_TP(tcbp) \
+  ({ INTERNAL_SYSCALL_DECL (err);					\
+     long result_var;							\
+     result_var = INTERNAL_SYSCALL (set_thread_area, err, 1,		\
+                    (char *) (tcbp) + TLS_TCB_OFFSET);			\
+     INTERNAL_SYSCALL_ERROR_P (result_var, err)				\
+       ? "unknown error" : NULL; })
+
+/* Return the address of the dtv for the current thread.  */
+#define THREAD_DTV() \
+  (((tcbhead_t *) (READ_THREAD_POINTER () - TLS_TCB_OFFSET))->dtv)
+
+/* Return the thread descriptor for the current thread.  */
+#undef THREAD_SELF
+#define THREAD_SELF \
+ ((struct pthread *) (READ_THREAD_POINTER ()				\
+              - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
+
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+#define DB_THREAD_SELF \
+  CONST_THREAD_AREA (32, sizeof (struct pthread))
+
+/* Access to data in the thread descriptor is easy.  */
+#define THREAD_GETMEM(descr, member) \
+  descr->member
+#define THREAD_GETMEM_NC(descr, member, idx) \
+  descr->member[idx]
+#define THREAD_SETMEM(descr, member, value) \
+  descr->member = (value)
+#define THREAD_SETMEM_NC(descr, member, idx, value) \
+  descr->member[idx] = (value)
+
+/* Set the pointer guard field in the TCB head.  */
+# define THREAD_GET_POINTER_GUARD() \
+  THREAD_GETMEM (((tcbhead_t *) READ_THREAD_POINTER ()), pointer_guard)
+#define THREAD_SET_POINTER_GUARD(value) \
+  THREAD_SETMEM (((tcbhead_t *) READ_THREAD_POINTER ()), pointer_guard, value)
+#define THREAD_COPY_POINTER_GUARD(descr) \
+  ((tcbhead_t *) ((char *) (descr) + TLS_PRE_TCB_SIZE))->pointer_guard	      \
+   = THREAD_GET_POINTER_GUARD()
+
+/* Get and set the global scope generation counter in struct pthread.  */
+#define THREAD_GSCOPE_IN_TCB      1
+#define THREAD_GSCOPE_FLAG_UNUSED 0
+#define THREAD_GSCOPE_FLAG_USED   1
+#define THREAD_GSCOPE_FLAG_WAIT   2
+#define THREAD_GSCOPE_RESET_FLAG() \
+  do									      \
+    { int __res								      \
+	= atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,	      \
+			       THREAD_GSCOPE_FLAG_UNUSED);		      \
+      if (__res == THREAD_GSCOPE_FLAG_WAIT)				      \
+	lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE);    \
+    }									      \
+  while (0)
+#define THREAD_GSCOPE_SET_FLAG() \
+  do									      \
+    {									      \
+      THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED;	      \
+      atomic_write_barrier ();						      \
+    }									      \
+  while (0)
+#define THREAD_GSCOPE_WAIT() \
+  GL(dl_wait_lookup_done) ()
+
+#endif /* __ASSEMBLER__ */
+
+#endif	/* tls.h */
diff --git a/sysdeps/csky/stackinfo.h b/sysdeps/csky/stackinfo.h
new file mode 100644
index 0000000..7b5eb65
--- /dev/null
+++ b/sysdeps/csky/stackinfo.h
@@ -0,0 +1,32 @@
+/* This file contains a bit of information about the stack allocation
+   of the processor.  C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H	1
+
+#include <elf.h>
+
+/* On C-SKY the stack grows down.  */
+#define _STACK_GROWS_DOWN	1
+
+/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
+ * present, but it is presumed absent.  */
+#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
+
+#endif	/* stackinfo.h */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (5 preceding siblings ...)
  2018-04-08  7:03 ` [RFC PATCH V2 01/10] C-SKY: ABI related code Mao Han
@ 2018-04-08  7:03 ` Mao Han
  2018-04-15 20:29   ` Arnd Bergmann
  2018-04-23 11:32   ` Adhemerval Zanella
  2018-04-08  7:03 ` [RFC PATCH V2 04/10] C-SKY: Hard Float Support Mao Han
                   ` (4 subsequent siblings)
  11 siblings, 2 replies; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

Contains the Linux system call interface.

        * sysdeps/unix/sysv/linux/csky/____longjmp_chk.S: New file
        * sysdeps/unix/sysv/linux/csky/abiv2_brk.c: New file
        * sysdeps/unix/sysv/linux/csky/abiv2_clone.S: New file
        * sysdeps/unix/sysv/linux/csky/abiv2_getcontext.S: New file
        * sysdeps/unix/sysv/linux/csky/abiv2_setcontext.S: New file
        * sysdeps/unix/sysv/linux/csky/abiv2_syscall.S: New file
        * sysdeps/unix/sysv/linux/csky/abiv2_vfork.S: New file
        * sysdeps/unix/sysv/linux/csky/brk.c: New file
        * sysdeps/unix/sysv/linux/csky/clone.S: New file
        * sysdeps/unix/sysv/linux/csky/ftruncate64.c: New file
        * sysdeps/unix/sysv/linux/csky/getcontext.S: New file
        * sysdeps/unix/sysv/linux/csky/libc-read_tp.S: New file
        * sysdeps/unix/sysv/linux/csky/pt-vfork.S: New file
        * sysdeps/unix/sysv/linux/csky/read_tp.S: New file
        * sysdeps/unix/sysv/linux/csky/readahead.c: New file
        * sysdeps/unix/sysv/linux/csky/scandir64.c: New file
        * sysdeps/unix/sysv/linux/csky/syscall.S: New file
        * sysdeps/unix/sysv/linux/csky/syscalls.list: New file
---
 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/brk.c              |  61 +++++++++++
 sysdeps/unix/sysv/linux/csky/clone.S            |  99 ++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/ftruncate64.c      |  41 ++++++++
 sysdeps/unix/sysv/linux/csky/getcontext.S       | 108 ++++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/libc-read_tp.S     |   1 +
 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/scandir64.c        |   1 +
 sysdeps/unix/sysv/linux/csky/syscall.S          |  61 +++++++++++
 sysdeps/unix/sysv/linux/csky/syscalls.list      |   7 ++
 18 files changed, 1031 insertions(+)
 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/brk.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/clone.S
 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/libc-read_tp.S
 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/scandir64.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/syscall.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/syscalls.list

diff --git a/sysdeps/unix/sysv/linux/csky/____longjmp_chk.S b/sysdeps/unix/sysv/linux/csky/____longjmp_chk.S
new file mode 100644
index 0000000..7e50d92
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/____longjmp_chk.S
@@ -0,0 +1,129 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+	.section .rodata.str1.8,"aMS",@progbits,1
+	.align  2
+	.type   longjmp_msg,@object
+longjmp_msg:
+	.string "longjmp causes uninitialized stack frame"
+	.size   longjmp_msg, .-longjmp_msg
+	.text
+
+#define __longjmp ____longjmp_chk
+
+#ifdef	__PIC__
+# ifdef	__CSKYABIV2__
+#  define CALL_FAIL	\
+	subi    sp, 8;						\
+	stw     gb, (sp, 0);					\
+	grs     gb, .Lgetpc1;					\
+.Lgetpc1:							\
+	lrw     t0, .Lgetpc1@GOTPC;				\
+	addu	gb, gb, t0;					\
+	lrw     a0, longjmp_msg@GOTOFF;				\
+	addu	a0, a0, gb;					\
+	lrw     t0, (HIDDEN_JUMPTARGET(__fortify_fail))@PLT;	\
+	ldr.w	t0, (gb, t0 << 0);				\
+	jsr     t0;						\
+	ldw     gb, (sp, 0);					\
+	addi    sp, 8;
+# else /* __CSKYABIV2__ */
+#  define CALL_FAIL	\
+	subi    sp, 8;						\
+	stw     gb, (sp);					\
+	stw     r15, (sp, 4);					\
+	bsr     .Lgetpc2;					\
+.Lgetpc2:							\
+	lrw     gb, .Lgetpc2@GOTPC;				\
+	add     gb, r15;					\
+	lrw     a0, longjmp_msg@GOTOFF;				\
+	addu	a0, gb;						\
+	lrw     r7, (HIDDEN_JUMPTARGET(__fortify_fail))@PLT;	\
+	add     r7, gb;						\
+	ldw     r7, (r7);					\
+	jsr     r7;						\
+	ldw     gb, (sp, 0);					\
+	ldw     r15,(sp, 4);					\
+	addi    sp, 8;
+# endif /* __CSKYABIV2__ */
+#else /* __PIC__ */
+# define CALL_FAIL	\
+	lrw     a0, longjmp_msg;				\
+	jsri    HIDDEN_JUMPTARGET(__fortify_fail);
+#endif/* __PIC__ */
+
+#ifdef	__CSKYABIV2__
+# define  CHECK_SP(reg)	\
+	cmplt   sp, reg;					\
+	bt      .Lok1;						\
+	mov     r9, a0;						\
+	mov     t0, r7;						\
+	lrw     r7, __NR_sigaltstack;				\
+	movi	a0, 0;						\
+	subi	sp, 12;	/* sizeof (stack_t) */			\
+	mov     a1, sp;						\
+	trap    0;						\
+	mov     r7, t0;						\
+	cmpnei  a0, 0;						\
+	bt      .Lok;						\
+	ldw     a1, (sp, 4);					\
+	btsti   a1, 1;						\
+	bt      .Lfail;						\
+	ldw     a1, (sp, 0);					\
+	ldw     a3, (sp, 8);					\
+	add     a1, a3;						\
+	sub     a1, reg;					\
+	cmphs   a1, a3;						\
+	bt      .Lok;						\
+.Lfail:								\
+	addi    sp, 12;						\
+	CALL_FAIL						\
+.Lok:								\
+	mov     a0, r9;						\
+.Lok1:
+#else
+# define  CHECK_SP(reg)	\
+	cmplt   sp, reg;					\
+	bt      .Lok1;						\
+	mov     r9, a0;						\
+	lrw     r1, __NR_sigaltstack;				\
+	movi	a0, 0;						\
+	subi	sp, 12;	/* sizeof (stack_t) */			\
+	mov     a1, sp;						\
+	trap    0;						\
+	cmpnei  a0, 0;						\
+	bt      .Lok;						\
+	ldw     a1, (sp, 4);					\
+	btsti   a1, 1;						\
+	bt      .Lfail;						\
+	ldw     a1, (sp, 0);					\
+	ldw     a3, (sp, 8);					\
+	add     a1, a3;						\
+	sub     a1, reg;					\
+	cmphs   a1, a3;						\
+	bt      .Lok;						\
+.Lfail:								\
+	addi    sp, 12;						\
+	CALL_FAIL						\
+.Lok:								\
+	mov     a0, r9;						\
+.Lok1:
+#endif
+
+#include <__longjmp.S>
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2_brk.c b/sysdeps/unix/sysv/linux/csky/abiv2_brk.c
new file mode 100644
index 0000000..a564276
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2_brk.c
@@ -0,0 +1,56 @@
+/* brk system call for Linux/C-SKY.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <errno.h>
+
+/* This must be initialized data because commons can't have aliases.  */
+void * __curbrk = 0;
+
+/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
+   to work around different old braindamage in the old Linux/x86 ELF
+   dynamic linker.  Sigh.  */
+weak_alias (__curbrk, ___brk_addr)
+
+int __brk (void *addr)
+{
+    void *newbrk;
+
+    {
+      register long int res __asm__("a0") = (long int)addr;
+
+      __asm__ volatile ("lrw l3, %1\n\t"
+                        "trap 0     \n\t"
+                        :"+r" (res)
+                        :"i" (__NR_brk)
+                        :"l3");
+      newbrk = (void *) res;
+    }
+    __curbrk = newbrk;
+
+    if (newbrk < addr)
+    {
+        __set_errno (ENOMEM);
+	return -1;
+    }
+
+    return 0;
+}
+
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2_clone.S b/sysdeps/unix/sysv/linux/csky/abiv2_clone.S
new file mode 100644
index 0000000..bebde43
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2_clone.S
@@ -0,0 +1,106 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* clone() is even more special than fork() as it mucks with stacks
+   and invokes a function in the right context after its all over.  */
+
+#include <sysdep.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+#include <csky_readtp.h>
+
+#define CLONE_VM      8  /* 8 makes btsti easier, 0x00000100 in real */
+#define CLONE_THREAD  16  /* 0x00010000 in real */
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
+	     pid_t *ptid, struct user_desc *tls, pid_t *ctid); */
+
+        .text
+ENTRY(__clone)
+	/* Sanity check arguments.  */
+	cmpnei	a0, 0		/* no NULL function pointers */
+	bf	__error_arg
+	cmpnei	a1, 0		/* no NULL function pointers */
+	bf	__error_arg
+
+	subi	a1, 8
+	stw	a0, (a1, 0)	/* insert the args onto the new stack */
+	stw	a3, (a1, 4)	/* insert the args onto the new stack */
+
+	mov	t1, r7		/* save r7 */
+	mov	t2, r4		/* save r4 (has t2 ?)*/
+
+	mov	a0, a2		/* arg1 = flags */
+	ldw	a2, (sp, 0)	/* arg3 = ptid */
+	ldw	a3, (sp, 8)	/* arg4 = ctid */
+	ldw	r4, (sp, 4)	/* arg5 = tls */
+	lrw	r7, __NR_clone
+	trap	0
+
+	mov	r7, t1		/* restore r7 */
+	mov	r4, t2		/* restore r4 */
+	btsti	a0, 31		/* is a0 less than zero? */
+	bt	do_syscall_error
+	cmpnei	a0, 0
+	bf	1f
+	rts
+PSEUDO_END (__clone)
+
+1:
+	ldw	a0, (sp, 4)	/* restore args from new sp */
+	ldw	a1, (sp, 0)	/* restore args from new sp */
+	addi	sp, 8
+	jsr	a1
+
+	/* exit */
+#ifdef __PIC__
+        grs     t1, .Lgetpc1
+.Lgetpc1:
+        lrw     t0, .Lgetpc1@GOTPC
+        addu    t1, t1, t0
+        lrw     t0, _exit@GOT
+        ldr.w   t0, (t1, t0 << 0)
+#else
+        lrw     t0, _exit       /* exit */
+#endif /* __PIC__ */
+        jmp     t0
+
+__error_arg:
+	lrw	a0, -EINVAL
+
+do_syscall_error:
+#ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+	stw	r15, (sp, 4)
+	grs	gb, .Lgetpc2
+.Lgetpc2:
+	lrw	t0, .Lgetpc2@GOTPC
+	addu	gb, gb, t0
+	lrw	t0, __syscall_error@PLT
+	ldr.w	t0, (gb, t0 << 0)
+	jsr	t0
+	ldw	gb, (sp, 0)
+	ldw	r15, (sp, 4)
+	addi	sp, 8
+#else
+	jmpi	__syscall_error
+#endif /* __PIC__ */
+	rts
+
+libc_hidden_def (__clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2_getcontext.S b/sysdeps/unix/sysv/linux/csky/abiv2_getcontext.S
new file mode 100644
index 0000000..c85cbac
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2_getcontext.S
@@ -0,0 +1,72 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int getcontext (ucontext_t *ucp) */
+
+ENTRY(__getcontext)
+	/* No need to save r2-r7 or a0-a3 */
+	mov	t0, a0
+
+	addi	a0, MCONTEXT_CSKY_R4
+
+	stm	r4-r13, (a0)			/* save r4-r13 */
+	stw	sp, (t0, MCONTEXT_CSKY_SP)	/* save sp */
+	stw	r15, (t0, MCONTEXT_CSKY_LR)	/* save lr */
+	stw	r15, (t0, MCONTEXT_CSKY_PC)	/* Return to PC */
+	addi	a0, t0, MCONTEXT_CSKY_R16
+	stm	r16-r31, (a0)			/* save r16-r31 */
+	movi	a0, 0
+	stw	a0, (t0, MCONTEXT_CSKY_A0)	/* Return zero */
+
+	subi	sp, 8
+	stw	t0, (sp, 0)			/* save t0 after "save sp" */
+
+	/* __sigprocmask(SIG_BLOCK, NULL, &(ucontext->uc_sigmask)) */
+	movi	a0, SIG_BLOCK
+	movi	a1, 0
+	addi	a2, t0, UCONTEXT_SIGMASK
+
+	/* do sigprocmask syscall */
+#ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+	grs	gb, .Lgetpc
+.Lgetpc:
+	lrw	a3, .Lgetpc@GOTPC
+	addu	gb, gb, a3
+	lrw	a3, __sigprocmask@PLT
+	ldr.w	a3, (gb, a3 << 0)
+	jsr	a3
+	ldw	gb, (sp, 0)
+	addi	sp, 8
+#else
+	jsri    __sigprocmask
+#endif
+
+	ldw	t0, (sp, 0)
+	addi	sp, 8
+	/* restore r15 for sigprocmask changes*/
+	ldw	r15, (t0, MCONTEXT_CSKY_LR)
+	movi	a0, 0				/* return 0 */
+	jmp	r15
+END(__getcontext)
+
+weak_alias(__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2_setcontext.S b/sysdeps/unix/sysv/linux/csky/abiv2_setcontext.S
new file mode 100644
index 0000000..50c47eb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2_setcontext.S
@@ -0,0 +1,95 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int setcontext (const ucontext_t *ucp) */
+
+ENTRY(__setcontext)
+	mov	t0, a0
+	subi	sp, 8
+	stw	a0, (sp, 0)
+
+	/* set sigmask */
+	movi	a0, SIG_SETMASK
+	addi	a1, t0, UCONTEXT_SIGMASK
+	movi	a2, 0
+
+	/* do sigprocmask syscall */
+#ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+	grs	gb, .Lgetpc1
+.Lgetpc1:
+	lrw	a3, .Lgetpc1@GOTPC
+	addu	gb, gb, a3
+	lrw	a3, __sigprocmask@PLT
+	ldr.w	a3, (gb, a3 << 0)
+	jsr	a3
+	ldw	gb, (sp, 0)
+	addi	sp, 8
+#else
+	jsri	__sigprocmask
+#endif /* __PIC__ */
+
+	ldw	t0, (sp, 0)
+	addi	sp, 8
+	/* set r0-r11. Load a0-a3, for makecontext requires */
+	addi	t1, t0, MCONTEXT_CSKY_A0
+	ldm	r0-r11, (t1)
+	ldw	sp, (t0, MCONTEXT_CSKY_SP)	/* load sp */
+	ldw	r15, (t0, MCONTEXT_CSKY_LR)	/* load lr */
+	ldw	t0, (t0, MCONTEXT_CSKY_PC)	/* load start addr */
+	jmp	t0
+END(setcontext)
+weak_alias(__setcontext, setcontext)
+
+ENTRY(__startcontext)
+	mov	a0, r9
+	cmpnei	r9, 0	/* r9 was set in makecontext */
+	bf	1f	/* null, then exit */
+
+	/* call setcontext */
+#ifdef __PIC__
+	grs	t1, .Lgetpc2
+.Lgetpc2:
+	lrw	t0, .Lgetpc2@GOTPC
+	addu	t1, t1, t0
+	lrw	t0, __setcontext@GOT
+	ldr.w	t0, (t1, t0 << 0)
+#else
+	lrw	t0, __setcontext
+#endif
+	jsr	t0
+
+1:
+	/* call _exit */
+#ifdef __PIC__
+	grs	t1, .Lgetpc3
+.Lgetpc3:
+	lrw	t0, .Lgetpc3@GOTPC
+	addu	t1, t1, t0
+	lrw	t0, _exit@GOT
+	ldr.w	t0, (t1, t0 << 0)
+#else
+	lrw	t0, _exit
+#endif
+	jsr	t0
+
+END(__startcontext)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2_syscall.S b/sysdeps/unix/sysv/linux/csky/abiv2_syscall.S
new file mode 100644
index 0000000..d1d1cb3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2_syscall.S
@@ -0,0 +1,68 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+/* long syscall(long sysnum, long a, long b, long c, long d, long e, long f) */
+
+ENTRY (syscall)
+	subi	sp, 8
+	stw	r4, (sp, 0)
+	stw	r5, (sp, 4)
+
+	mov	t0, r7
+	mov	r7, a0		/* r7 = sysnum */
+
+	mov	a0, a1		/* arg1 = a */
+	mov	a1, a2		/* arg2 = b */
+	mov	a2, a3		/* arg3 = c */
+	ldw	a3, (sp, 8)	/* arg4 = d */
+	ldw	r4, (sp, 12)	/* arg5 = e */
+	ldw	r5, (sp, 16)	/* arg6 = f */
+	trap	0
+
+	mov	r7, t0
+
+	ldw	r4, (sp, 0)
+	ldw	r5, (sp, 4)
+	addi	sp, 8
+
+	lrw	t0, 0xfffff000
+	cmphs	a0, t0
+	bt	do_syscall_error
+	rts
+PSEUDO_END (syscall)
+
+do_syscall_error:
+#ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+        stw     lr, (sp, 4)
+	grs	gb, .Lgetpc
+.Lgetpc:
+	lrw	t0, .Lgetpc@GOTPC
+	addu	gb, gb, t0
+	lrw	t0, __syscall_error@PLT
+	ldr.w	t0, (gb, t0 << 0)
+	jsr	t0
+	ldw	gb, (sp, 0)
+        ldw     lr, (sp, 4)
+	addi	sp, 8
+#else
+	jmpi	__syscall_error
+#endif /* __PIC__ */
+	rts
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2_vfork.S b/sysdeps/unix/sysv/linux/csky/abiv2_vfork.S
new file mode 100644
index 0000000..88cdc8a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2_vfork.S
@@ -0,0 +1,45 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+/* Clone the calling process, but without copying the whole address space.
+   The calling process is suspended until the new process exits or is
+   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
+   and the process ID of the new process to the old process.  */
+
+ENTRY (__vfork)
+#ifdef SAVE_PID
+	SAVE_PID
+#endif
+	mov	t0, r7
+	lrw	r7, __NR_vfork
+	trap	0
+	mov	r7, t0
+#ifdef RESTORE_PID
+	RESTORE_PID
+#endif
+	PSEUDO_RET
+	rts
+
+PSEUDO_END (__vfork)
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
+strong_alias (__vfork, __libc_vfork)
diff --git a/sysdeps/unix/sysv/linux/csky/brk.c b/sysdeps/unix/sysv/linux/csky/brk.c
new file mode 100644
index 0000000..00d42c2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/brk.c
@@ -0,0 +1,61 @@
+/* brk system call for Linux/C-SKY.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __CSKYABIV2__
+# include "abiv2_brk.c"
+#else
+
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <errno.h>
+
+/* This must be initialized data because commons can't have aliases.  */
+void * __curbrk = 0;
+
+/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
+   to work around different old braindamage in the old Linux/x86 ELF
+   dynamic linker.  Sigh.  */
+weak_alias (__curbrk, ___brk_addr)
+
+int __brk (void *addr)
+{
+    void *newbrk;
+
+    {
+      register long int res __asm__("r2") = (long int)addr;
+
+      __asm__ volatile ("lrw  r1, %1\n\t"
+                        "trap 0\n\t"
+                        :"+r" (res)
+                        :"i" (__NR_brk) :"r1");
+      newbrk = (void *) res;
+    }
+    __curbrk = newbrk;
+
+    if (newbrk < addr)
+    {
+        __set_errno (ENOMEM);
+	return -1;
+    }
+
+    return 0;
+}
+
+weak_alias (__brk, brk)
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/csky/clone.S b/sysdeps/unix/sysv/linux/csky/clone.S
new file mode 100644
index 0000000..38531f9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/clone.S
@@ -0,0 +1,99 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* clone() is even more special than fork() as it mucks with stacks
+   and invokes a function in the right context after its all over.  */
+
+#ifdef	__CSKYABIV2__
+# include "abiv2_clone.S"
+#else
+
+# include <sysdep.h>
+# define _ERRNO_H	1
+# include <bits/errno.h>
+# include <csky_readtp.h>
+
+# define CLONE_VM      8  /* 11 makes btsti easier, 0x00000100 in real */
+# define CLONE_THREAD  16  /* 0x00010000 in real */
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
+	     pid_t *ptid, struct user_desc *tls, pid_t *ctid); */
+
+        .text
+ENTRY(__clone)
+	/* Sanity check arguments. */
+	cmpnei	r2, 0
+	bf	__error_arg	/* no NULL function pointers */
+	cmpnei	r3, 0
+	bf	__error_arg	/* no NULL function pointers */
+
+	subi	r3, 8
+	stw	r2, (r3, 0)	/* insert the args onto the new stack */
+	stw	r5, (r3, 4)	/* insert the args onto the new stack */
+
+	ldw	r5, (sp, 0)	/* arg4 = ctid */
+
+	mov	r2, r4		/* arg1 = flags */
+	mov	r4, r6		/* arg3 = ptid */
+	mov	r6, r7		/* arg5 = tls */
+	lrw	r1, __NR_clone	/* do syscall */
+	trap	0
+
+	btsti	r2, 31		/* is r2 less than zero? */
+	bt	do_syscall_error
+	cmpnei	r2, 0
+	bf	1f
+	rts
+PSEUDO_END (__clone)
+
+1:
+	ldw	r2, (sp, 4)	/* restore args from new sp */
+	ldw	r3, (sp, 0)	/* restore args from new sp */
+	addi	sp, 8
+
+	jsr	r3
+	lrw	r1, __NR_exit
+	trap	0
+
+__error_arg:
+	lrw	r2, -EINVAL
+
+do_syscall_error:
+# ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+	stw	r15, (sp, 4)
+	bsr	.Lgetpc
+.Lgetpc:
+	lrw	gb, .Lgetpc@GOTPC
+	addu	gb, r15
+	lrw	r7, __syscall_error@PLT
+	addu	r7, gb
+	ldw	r7, (r7)
+	jsr	r7
+	ldw	gb, (sp, 0)
+	ldw	r15, (sp, 4)
+	addi	sp, 8
+# else
+	jmpi	 __syscall_error
+# endif /* __PIC__ */
+	rts
+
+libc_hidden_def (__clone)
+weak_alias (__clone, clone)
+
+#endif	/* __CSKYABIV2__*/
diff --git a/sysdeps/unix/sysv/linux/csky/ftruncate64.c b/sysdeps/unix/sysv/linux/csky/ftruncate64.c
new file mode 100644
index 0000000..47c38e6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/ftruncate64.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <endian.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Truncate the file FD refers to to LENGTH bytes.  */
+int
+__ftruncate64 (int fd, off64_t length)
+{
+  unsigned int low = length & 0xffffffff;
+  unsigned int high = length >> 32;
+#ifdef __CSKYABIV2__
+  int result = INLINE_SYSCALL (ftruncate64, 3, fd,
+			       __LONG_LONG_PAIR (high, low));
+#else
+  int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
+			       __LONG_LONG_PAIR (high, low));
+#endif
+  return result;
+}
+weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/unix/sysv/linux/csky/getcontext.S b/sysdeps/unix/sysv/linux/csky/getcontext.S
new file mode 100644
index 0000000..447c15b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/getcontext.S
@@ -0,0 +1,108 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __CSKYABIV2__
+#include "abiv2_getcontext.S"
+#else
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int getcontext (ucontext_t *ucp) */
+
+ENTRY(__getcontext)
+	/* No need to save r2-r7 or a0-a3 */
+	mov	r7, r2
+
+	/* return zero */
+	lrw	r2, MCONTEXT_CSKY_A0
+	add	r2, r7
+	movi	r1, 0
+	stw	r1, (r2)
+
+	lrw	r2, MCONTEXT_CSKY_R8
+	add	r2, r7
+	stw	r8, (r2, 0)			/* save r8 */
+	stw	r9, (r2, 4)			/* save r9 */
+	stw	r10, (r2, 8)			/* save r10 */
+	stw	r11, (r2, 12)			/* save r11 */
+	stw	r12, (r2, 16)			/* save r12 */
+	stw	r13, (r2, 20)			/* save r13 */
+	stw	r14, (r2, 24)			/* save r14 */
+	stw	r15, (r2, 28)			/* save lr */
+
+
+	lrw	r2, MCONTEXT_CSKY_SP
+	add	r2, r7
+	stw	sp, (r2)			/* save sp */
+
+	lrw	r2, MCONTEXT_CSKY_LR
+	add	r2, r7
+	stw	r15, (r2)			/* Return to LR */
+
+	lrw	r2, MCONTEXT_CSKY_PC
+	add	r2, r7
+	stw	r15, (r2)			/* Return to LR */
+
+	lrw	r2, MCONTEXT_CSKY_A0
+	add	r2, r7
+	movi	r3, 0
+	stw	r3, (r2)			/* Return zero */
+
+	/* __sigprocmask(SIG_BLOCK, NULL, &(ucontext->uc_sigmask)) */
+	lrw	r2, SIG_BLOCK
+	movi	r3, 0
+	lrw	r4, UCONTEXT_SIGMASK
+	add	r4, r7
+
+	subi	sp, 8
+	stw	r7, (sp, 0)
+
+	/* do sigprocmask syscall */
+#ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+	stw	lr, (sp, 4)
+	bsr	.Lgetpc
+.Lgetpc:
+	lrw	gb, .Lgetpc@GOTPC
+	addu	gb, r15
+	lrw	r7, __sigprocmask@PLT
+	addu	r7, gb
+	ldw	r7, (r7)
+	jsr	r7
+	ldw	gb, (sp, 0)
+	ldw	lr, (sp, 4)
+	addi	sp, 8
+#else
+        jsri	__sigprocmask
+#endif
+
+	ldw	r7, (sp, 0)
+	addi	sp, 8
+	lrw	r2, MCONTEXT_CSKY_LR
+	add	r2, r7
+	/* restore r15 for sigprocmask changes */
+	ldw	r15, (r2)
+	movi	r2, 0				/* return 0 */
+	jmp	r15
+END(__getcontext)
+
+weak_alias(__getcontext, getcontext)
+
+#endif	/* __CSKYABIV2__*/
diff --git a/sysdeps/unix/sysv/linux/csky/libc-read_tp.S b/sysdeps/unix/sysv/linux/csky/libc-read_tp.S
new file mode 100644
index 0000000..ca9d2b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/libc-read_tp.S
@@ -0,0 +1 @@
+#include <read_tp.S>
diff --git a/sysdeps/unix/sysv/linux/csky/pt-vfork.S b/sysdeps/unix/sysv/linux/csky/pt-vfork.S
new file mode 100644
index 0000000..65cc382
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/pt-vfork.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/alpha/pt-vfork.S>
diff --git a/sysdeps/unix/sysv/linux/csky/read_tp.S b/sysdeps/unix/sysv/linux/csky/read_tp.S
new file mode 100644
index 0000000..dc403da
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/read_tp.S
@@ -0,0 +1,46 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <features.h>
+#include <sysdep.h>
+
+/* This function is exported from libc for use by user code.  libpthread, librt,
+   and the dynamic linker get their own private copies, for
+   performance (and in the case of ld.so, out of necessity); those are
+   all hidden.  */
+
+/*
+ * __read_tp
+ * clobbe r0, others had to be saved
+ *
+ */
+#if IS_IN (libc)
+	.global __read_tp
+#else
+	.hidden __read_tp
+#endif
+#ifdef __CSKYABIV2__
+ENTRY (__read_tp)
+	mov	r0, r31
+	rts
+END (__read_tp)
+#else
+ENTRY (__read_tp)
+	trap	3
+	rts
+END (__read_tp)
+#endif
diff --git a/sysdeps/unix/sysv/linux/csky/readahead.c b/sysdeps/unix/sysv/linux/csky/readahead.c
new file mode 100644
index 0000000..255361c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/readahead.c
@@ -0,0 +1,34 @@
+/* Provide kernel hint to read ahead.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <endian.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+ssize_t
+__readahead (int fd, off64_t offset, size_t count)
+{
+  return INLINE_SYSCALL_CALL (readahead, fd,
+                              __ALIGNMENT_ARG SYSCALL_LL64 (offset), count);
+}
+
+weak_alias (__readahead, readahead)
diff --git a/sysdeps/unix/sysv/linux/csky/scandir64.c b/sysdeps/unix/sysv/linux/csky/scandir64.c
new file mode 100644
index 0000000..506fd88
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/scandir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/csky/syscall.S b/sysdeps/unix/sysv/linux/csky/syscall.S
new file mode 100644
index 0000000..9b700a3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/syscall.S
@@ -0,0 +1,61 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __CSKYABIV2__
+# include "abiv2_syscall.S"
+#else
+
+# include <sysdep.h>
+
+ENTRY (syscall)
+	mov	r1, r2		/* syscall num */
+
+	mov	r2, r3		/* arg1 */
+	mov	r3, r4		/* arg2 */
+	mov	r4, r5		/* arg3 */
+	mov	r5, r6		/* arg4*/
+	mov	r6, r7		/* arg5*/
+	ld	r7, (sp, 0)	/* arg6 */
+	trap	0
+	lrw	r3, 0xfffff000
+	cmphs	r2, r3
+	bt	do_syscall_error
+	rts
+PSEUDO_END (syscall)
+
+do_syscall_error:
+# ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+	stw	r15, (sp, 4)
+	bsr	.Lgetpc
+.Lgetpc:
+	lrw	gb, .Lgetpc@GOTPC
+	addu	gb, r15
+	lrw	r7, __syscall_error@PLT
+	addu	r7, gb
+	ldw	r7, (r7)
+	jsr	r7
+	ldw	gb, (sp, 0)
+	ldw	r15, (sp, 4)
+	addi	sp, 8
+# else
+	jmpi	__syscall_error
+# endif /* __PIC__ */
+	rts
+
+#endif /* __CSKYABVI2__ */
diff --git a/sysdeps/unix/sysv/linux/csky/syscalls.list b/sysdeps/unix/sysv/linux/csky/syscalls.list
new file mode 100644
index 0000000..53cff69
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/syscalls.list
@@ -0,0 +1,7 @@
+# File name	Caller	Syscall name	Args	Strong name	Weak names
+
+chown		-	chown32		i:sii	__chown		chown
+cacheflush	-	cacheflush	i:pii	_flush_cache	cacheflush
+
+prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
+fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [RFC PATCH V2 10/10] C-SKY: Linux ABI
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (8 preceding siblings ...)
  2018-04-08  7:03 ` [RFC PATCH V2 02/10] C-SKY: TLS support Mao Han
@ 2018-04-08  7:04 ` Mao Han
  2018-04-17 20:56   ` Joseph Myers
  2018-04-08  7:51 ` [RFC PATCH V2 00/10] port C-SKY to glibc Florian Weimer
  2018-04-17 20:44 ` Joseph Myers
  11 siblings, 1 reply; 35+ messages in thread
From: Mao Han @ 2018-04-08  7:04 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky

Linux-specific code that is required for maintaining ABI compatibility.
This doesn't contain the actual system call interface.

        * sysdeps/csky/nptl/pthread-offsets.h: New file
        * sysdeps/csky/nptl/pthreaddef.h: New file
        * sysdeps/unix/sysv/linux/csky/Versions: New file
        * sysdeps/unix/sysv/linux/csky/bits/fcntl.h: New file
        * sysdeps/unix/sysv/linux/csky/bits/mman.h: New file
        * sysdeps/unix/sysv/linux/csky/bits/shm.h: New file
        * sysdeps/unix/sysv/linux/csky/c++-types.data: New file
        * sysdeps/unix/sysv/linux/csky/csky_readtp.h: New file
        * sysdeps/unix/sysv/linux/csky/ipc_priv.h: New file
        * sysdeps/unix/sysv/linux/csky/jmp_buf-macros.h: New file
        * sysdeps/unix/sysv/linux/csky/kernel-features.h: New file
        * sysdeps/unix/sysv/linux/csky/makecontext.c: New file
        * sysdeps/unix/sysv/linux/csky/profil-counter.h: New file
        * sysdeps/unix/sysv/linux/csky/register-dump.h: New file
        * sysdeps/unix/sysv/linux/csky/setcontext.S: New file
        * sysdeps/unix/sysv/linux/csky/shlib-versions: New file
        * sysdeps/unix/sysv/linux/csky/sigcontextinfo.h: New file
        * sysdeps/unix/sysv/linux/csky/swapcontext.S: New file
        * sysdeps/unix/sysv/linux/csky/sys/cachectl.h: New file
        * sysdeps/unix/sysv/linux/csky/sys/procfs.h: New file
        * sysdeps/unix/sysv/linux/csky/sys/ucontext.h: New file
        * sysdeps/unix/sysv/linux/csky/sys/user.h: New file
        * sysdeps/unix/sysv/linux/csky/sysdep-cancel.h: New file
        * sysdeps/unix/sysv/linux/csky/sysdep.S: New file
        * sysdeps/unix/sysv/linux/csky/sysdep.h: New file
        * sysdeps/unix/sysv/linux/csky/ucontext_i.sym: New file
---
 sysdeps/csky/nptl/pthread-offsets.h            |   5 +
 sysdeps/csky/nptl/pthreaddef.h                 |  40 ++
 sysdeps/unix/sysv/linux/csky/Versions          |  34 ++
 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/c++-types.data    |  67 +++
 sysdeps/unix/sysv/linux/csky/csky_readtp.h     |  24 +
 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/makecontext.c     |  81 +++
 sysdeps/unix/sysv/linux/csky/profil-counter.h  |  34 ++
 sysdeps/unix/sysv/linux/csky/register-dump.h   | 218 +++++++
 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/sysdep.S          | 110 ++++
 sysdeps/unix/sysv/linux/csky/sysdep.h          | 757 +++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/csky/ucontext_i.sym    |  31 +
 25 files changed, 2271 insertions(+)
 create mode 100644 sysdeps/csky/nptl/pthread-offsets.h
 create mode 100644 sysdeps/csky/nptl/pthreaddef.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/Versions
 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/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/csky/csky_readtp.h
 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/makecontext.c
 create mode 100644 sysdeps/unix/sysv/linux/csky/profil-counter.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/register-dump.h
 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/sysdep.S
 create mode 100644 sysdeps/unix/sysv/linux/csky/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/csky/ucontext_i.sym

diff --git a/sysdeps/csky/nptl/pthread-offsets.h b/sysdeps/csky/nptl/pthread-offsets.h
new file mode 100644
index 0000000..9617354
--- /dev/null
+++ b/sysdeps/csky/nptl/pthread-offsets.h
@@ -0,0 +1,5 @@
+#define __PTHREAD_MUTEX_NUSERS_OFFSET   16
+#define __PTHREAD_MUTEX_KIND_OFFSET     12
+#define __PTHREAD_MUTEX_SPINS_OFFSET    20
+#define __PTHREAD_MUTEX_ELISION_OFFSET  22
+#define __PTHREAD_MUTEX_LIST_OFFSET     20
diff --git a/sysdeps/csky/nptl/pthreaddef.h b/sysdeps/csky/nptl/pthreaddef.h
new file mode 100644
index 0000000..f6e3b65
--- /dev/null
+++ b/sysdeps/csky/nptl/pthreaddef.h
@@ -0,0 +1,40 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Default stack size.  */
+#define ARCH_STACK_DEFAULT_SIZE	(2 * 1024 * 1024)
+
+/* Required stack pointer alignment at beginning.  */
+#define STACK_ALIGN		8
+
+/* Minimal stack size after allocating thread descriptor and guard size.  */
+#define MINIMAL_REST_STACK	2048
+
+/* Alignment requirement for TCB.  */
+#define TCB_ALIGNMENT		8
+
+
+/* Location of current stack frame.
+
+   __builtin_frame_address (0) returns the value of the hard frame
+   pointer, which will point at the location of the saved PC on the
+   stack.  Below this in memory is the remainder of the linkage info,
+   occupying 12 bytes.  Therefore in order to address from
+   CURRENT_STACK_FRAME using "struct layout", we need to have the macro
+   return the hard FP minus 12.  Of course, this makes no sense
+   without the obsolete APCS stack layout...  */
+#define CURRENT_STACK_FRAME	(__builtin_frame_address (0) - 12)
diff --git a/sysdeps/unix/sysv/linux/csky/Versions b/sysdeps/unix/sysv/linux/csky/Versions
new file mode 100644
index 0000000..bcb77fd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/Versions
@@ -0,0 +1,34 @@
+libc {
+  GLIBC_2.27 {
+    #errlist-compat     134
+    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+
+    # Exception handling support functions from libgcc
+    __register_frame; __register_frame_table; __deregister_frame;
+    __frame_state_for; __register_frame_info_table;
+
+    # c*
+    cacheflush;
+
+    # functions used in other libraries
+    __xstat64; __fxstat64; __lxstat64;
+
+    # a*
+    alphasort64;
+
+    # g*
+    glob64;
+
+    # New rlimit interface
+    getrlimit; setrlimit; getrlimit64;
+
+    # r*
+    readdir64; readdir64_r;
+
+    # s*
+    scandir64;
+
+
+    fallocate64;
+  }
+}
diff --git a/sysdeps/unix/sysv/linux/csky/bits/fcntl.h b/sysdeps/unix/sysv/linux/csky/bits/fcntl.h
new file mode 100644
index 0000000..0f609c5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/bits/fcntl.h
@@ -0,0 +1,55 @@
+/* O_*, F_*, FD_* bit values for Linux.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __O_LARGEFILE  0
+#endif
+
+struct flock
+  {
+    short int l_type;   /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence; /* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;    /* Offset where the lock begins.  */
+    __off_t l_len;      /* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;  /* Offset where the lock begins.  */
+    __off64_t l_len;    /* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;      /* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;   /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence; /* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;  /* Offset where the lock begins.  */
+    __off64_t l_len;    /* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;      /* Process holding the lock.  */
+  };
+#endif
+
+/* Include generic Linux declarations.  */
+#include <bits/fcntl-linux.h>
diff --git a/sysdeps/unix/sysv/linux/csky/bits/mman.h b/sysdeps/unix/sysv/linux/csky/bits/mman.h
new file mode 100644
index 0000000..6ced845
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/bits/mman.h
@@ -0,0 +1,42 @@
+/* Definitions for POSIX memory map interface.  Linux/C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_MMAN_H
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
+#endif
+
+/* The following definitions basically come from the kernel headers.
+   But the kernel header is not namespace clean.  */
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
+# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
+# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
+# define MAP_STACK	0x20000		/* Allocation is for a stack.  */
+# define MAP_HUGETLB	0x40000		/* Create huge page mapping.  */
+# define MAP_SYNC	0x80000		/* Perform synchronous page
+					   faults for the mapping.  */
+#endif
+
+/* Include generic Linux declarations.  */
+#include <bits/mman-linux.h>
diff --git a/sysdeps/unix/sysv/linux/csky/bits/shm.h b/sysdeps/unix/sysv/linux/csky/bits/shm.h
new file mode 100644
index 0000000..d745233
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/bits/shm.h
@@ -0,0 +1,103 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Permission flag for shmget.  */
+#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
+#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'.  */
+#define SHM_RDONLY	010000		/* attach read-only else read-write */
+#define SHM_RND		020000		/* round attach address to SHMLBA */
+#define SHM_REMAP	040000		/* take-over region on attach */
+#define SHM_EXEC	0100000		/* execution access */
+
+/* Commands for `shmctl'.  */
+#define SHM_LOCK	11		/* lock segment (root only) */
+#define SHM_UNLOCK	12		/* unlock segment (root only) */
+
+__BEGIN_DECLS
+
+/* Segment low boundary address multiple.  */
+#define SHMLBA		(__getpagesize () << 2)
+extern int __getpagesize (void) __THROW __attribute__ ((__const__));
+
+
+/* Type to count number of attaches.  */
+typedef unsigned long int shmatt_t;
+
+/* Data structure describing a shared memory segment.  */
+struct shmid_ds
+  {
+    struct ipc_perm shm_perm;		/* operation permission struct */
+    size_t shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    unsigned long int __glibc_reserved1;
+    __time_t shm_dtime;			/* time of last shmdt() */
+    unsigned long int __glibc_reserved2;
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    unsigned long int __glibc_reserved3;
+    __pid_t shm_cpid;			/* pid of creator */
+    __pid_t shm_lpid;			/* pid of last shmop */
+    shmatt_t shm_nattch;		/* number of current attaches */
+    unsigned long int __glibc_reserved4;
+    unsigned long int __glibc_reserved5;
+  };
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+# define SHM_STAT 	13
+# define SHM_INFO 	14
+
+/* shm_mode upper byte flags */
+# define SHM_DEST	01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED	02000   /* segment will not be swapped */
+# define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
+
+struct	shminfo
+  {
+    unsigned long int shmmax;
+    unsigned long int shmmin;
+    unsigned long int shmmni;
+    unsigned long int shmseg;
+    unsigned long int shmall;
+    unsigned long int __glibc_reserved1;
+    unsigned long int __glibc_reserved2;
+    unsigned long int __glibc_reserved3;
+    unsigned long int __glibc_reserved4;
+  };
+
+struct shm_info
+  {
+    int used_ids;
+    unsigned long int shm_tot;	/* total allocated shm */
+    unsigned long int shm_rss;	/* total resident shm */
+    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int swap_attempts;
+    unsigned long int swap_successes;
+  };
+
+#endif /* __USE_MISC */
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/csky/c++-types.data b/sysdeps/unix/sysv/linux/csky/c++-types.data
new file mode 100644
index 0000000..303f457
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/c++-types.data
@@ -0,0 +1,67 @@
+blkcnt64_t:x
+blkcnt_t:l
+blksize_t:i
+caddr_t:Pc
+clockid_t:i
+clock_t:l
+daddr_t:i
+dev_t:y
+fd_mask:l
+fsblkcnt64_t:y
+fsblkcnt_t:m
+fsfilcnt64_t:y
+fsfilcnt_t:m
+fsid_t:8__fsid_t
+gid_t:j
+id_t:j
+ino64_t:y
+ino_t:m
+int16_t:s
+int32_t:i
+int64_t:x
+int8_t:a
+intptr_t:i
+key_t:i
+loff_t:x
+mode_t:j
+nlink_t:j
+off64_t:x
+off_t:l
+pid_t:i
+pthread_attr_t:14pthread_attr_t
+pthread_barrier_t:17pthread_barrier_t
+pthread_barrierattr_t:21pthread_barrierattr_t
+pthread_cond_t:14pthread_cond_t
+pthread_condattr_t:18pthread_condattr_t
+pthread_key_t:j
+pthread_mutex_t:15pthread_mutex_t
+pthread_mutexattr_t:19pthread_mutexattr_t
+pthread_once_t:i
+pthread_rwlock_t:16pthread_rwlock_t
+pthread_rwlockattr_t:20pthread_rwlockattr_t
+pthread_spinlock_t:i
+pthread_t:m
+quad_t:x
+register_t:i
+rlim64_t:y
+rlim_t:m
+sigset_t:10__sigset_t
+size_t:j
+socklen_t:j
+ssize_t:i
+suseconds_t:l
+time_t:l
+u_char:h
+uid_t:j
+uint:j
+u_int:j
+u_int16_t:t
+u_int32_t:j
+u_int64_t:y
+u_int8_t:h
+ulong:m
+u_long:m
+u_quad_t:y
+useconds_t:j
+ushort:t
+u_short:t
diff --git a/sysdeps/unix/sysv/linux/csky/csky_readtp.h b/sysdeps/unix/sysv/linux/csky/csky_readtp.h
new file mode 100644
index 0000000..fffd52c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/csky_readtp.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef	__CSKYABIV2__
+# define csky_read_tp	\
+	mov	a0, r31
+#else
+# define csky_read_tp	\
+	trap	3
+#endif
diff --git a/sysdeps/unix/sysv/linux/csky/ipc_priv.h b/sysdeps/unix/sysv/linux/csky/ipc_priv.h
new file mode 100644
index 0000000..38d86fd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/ipc_priv.h
@@ -0,0 +1,21 @@
+/* Old SysV permission definition for Linux.  CSKY version.
+   Copyright (C) 2017-2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/ipc.h>  /* For __key_t  */
+
+#define __IPC_64	0x0
diff --git a/sysdeps/unix/sysv/linux/csky/jmp_buf-macros.h b/sysdeps/unix/sysv/linux/csky/jmp_buf-macros.h
new file mode 100644
index 0000000..5a390c7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/jmp_buf-macros.h
@@ -0,0 +1,6 @@
+#define JMP_BUF_SIZE 268
+#define SIGJMP_BUF_SIZE 268
+#define JMP_BUF_ALIGN 4
+#define SIGJMP_BUF_ALIGN 4
+#define MASK_WAS_SAVED_OFFSET 136
+#define SAVED_MASK_OFFSET 140
diff --git a/sysdeps/unix/sysv/linux/csky/kernel-features.h b/sysdeps/unix/sysv/linux/csky/kernel-features.h
new file mode 100644
index 0000000..f1fbc71
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/kernel-features.h
@@ -0,0 +1,29 @@
+/* Set flags signalling availability of kernel features based on given
+   kernel version number.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include_next <kernel-features.h>
+
+/* fadvise64_64 reorganize the syscall arguments.  */
+#define __ASSUME_FADVISE64_64_6ARG	1
+
+/* Define this if your 32-bit syscall API requires 64-bit register
+   pairs to start with an even-number register.  */
+#ifdef __CSKYABIV1__
+# define __ASSUME_ALIGNED_REGISTER_PAIRS	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/csky/makecontext.c b/sysdeps/unix/sysv/linux/csky/makecontext.c
new file mode 100644
index 0000000..8585c5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/makecontext.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdarg.h>
+#include <ucontext.h>
+
+/* Number of arguments that go in registers.  */
+#ifdef __CSKYABIV2__
+# define NREG_ARGS  4
+#else
+# define NREG_ARGS  6
+#endif
+
+/* Take a context previously prepared via getcontext() and set to
+   call func() with the given int only args.  */
+void
+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
+{
+  extern void __startcontext (void);
+  unsigned long *funcstack;
+  va_list vl;
+  unsigned long *regptr;
+  unsigned int reg;
+  int misaligned;
+
+  /* Start at the top of stack.  */
+  funcstack = (unsigned long *) (ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
+
+  /* Ensure the stack stays eight byte aligned.  */
+  misaligned = ((unsigned long) funcstack & 4) != 0;
+
+  if ((argc > NREG_ARGS) && (argc & 1) != 0)
+    misaligned = !misaligned;
+
+  if (misaligned)
+    funcstack -= 1;
+
+  va_start (vl, argc);
+
+  /* Reserve space for the on-stack arguments.  */
+  if (argc > NREG_ARGS)
+    funcstack -= (argc - NREG_ARGS);
+
+  ucp->uc_mcontext.sc_usp = (unsigned long) funcstack;
+  ucp->uc_mcontext.sc_pc = (unsigned long) func;
+
+  /* Exit to startcontext() with the next context in R9 */
+#ifdef __CSKYABIV2__
+  ucp->uc_mcontext.sc_regs[5] = (unsigned long) ucp->uc_link;
+#else
+  ucp->uc_mcontext.sc_regs[3] = (unsigned long) ucp->uc_link;
+#endif
+  ucp->uc_mcontext.sc_r15 = (unsigned long) __startcontext;
+
+  /* The first four arguments go into registers.  */
+  regptr = &(ucp->uc_mcontext.sc_a0);
+
+  for (reg = 0; (reg < argc) && (reg < NREG_ARGS); reg++)
+    *regptr++ = va_arg (vl, unsigned long);
+
+  /* And the remainder on the stack.  */
+  for (; reg < argc; reg++)
+    *funcstack++ = va_arg (vl, unsigned long);
+
+  va_end (vl);
+}
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/csky/profil-counter.h b/sysdeps/unix/sysv/linux/csky/profil-counter.h
new file mode 100644
index 0000000..5d5ac34
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/profil-counter.h
@@ -0,0 +1,34 @@
+/* Low-level statistical profiling support function.  Linux/C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <signal.h>
+#include <sigcontextinfo.h>
+
+void
+__profil_counter (int signo, const SIGCONTEXT scp)
+{
+  profil_count ((void *) GET_PC (scp));
+
+  /* This is a hack to prevent the compiler from implementing the
+     above function call as a sibcall.  The sibcall would overwrite
+     the signal context.  */
+  asm volatile ("");
+}
+#ifndef __profil_counter
+weak_alias (__profil_counter, profil_counter)
+#endif
diff --git a/sysdeps/unix/sysv/linux/csky/register-dump.h b/sysdeps/unix/sysv/linux/csky/register-dump.h
new file mode 100644
index 0000000..2154544
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/register-dump.h
@@ -0,0 +1,218 @@
+/* Dump registers.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/uio.h>
+#include <_itoa.h>
+#include <bits/sigcontext.h>
+#include <sys/ucontext.h>
+
+/* We will print the register dump in this format:
+
+ PSR: XXXXXXXX  PC: XXXXXXXX   SP: XXXXXXXX   LR: XXXXXXXX
+ MASK: XXXXXXXX
+
+ A0: XXXXXXXX   A1: XXXXXXXX   A2: XXXXXXXX   A3: XXXXXXXX
+ R6: XXXXXXXX   R7: XXXXXXXX   R8: XXXXXXXX   R9: XXXXXXXX
+ R10: XXXXXXXX  R11: XXXXXXXX  R12: XXXXXXXX  R13: XXXXXXXX
+ R14: XXXXXXXX  R1: XXXXXXXX
+
+************************ I am cutter! *********************
+
+ PSR: XXXXXXXX  PC: XXXXXXXX   SP: XXXXXXXX   LR: XXXXXXXX
+ MASK: XXXXXXXX
+
+ A0: XXXXXXXX   A1: XXXXXXXX   A2: XXXXXXXX   A3: XXXXXXXX
+ R4: XXXXXXXX   R5: XXXXXXXX   R6: XXXXXXXX   R7: XXXXXXXX
+ R8: XXXXXXXX   R9: XXXXXXXX   R10: XXXXXXXX  R11: XXXXXXXX
+ R12: XXXXXXXX  R13: XXXXXXXX  R14: XXXXXXXX  R15: XXXXXXXX
+ R16: XXXXXXXX  R17: XXXXXXXX  R18: XXXXXXXX  R19: XXXXXXXX
+ R20: XXXXXXXX  R21: XXXXXXXX  R22: XXXXXXXX  R23: XXXXXXXX
+ R24: XXXXXXXX  R25: XXXXXXXX  R26: XXXXXXXX  R27: XXXXXXXX
+ R28: XXXXXXXX  R29: XXXXXXXX  R30: XXXXXXXX  R31: XXXXXXXX
+
+ */
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+  char *cp = _itoa_word (value, buf + len, 16, 0);
+  while (cp > buf)
+    *--cp = '0';
+}
+
+static void
+register_dump (int fd, const struct ucontext *ctx)
+{
+  char regs[35][8];
+  struct iovec iov[97];
+  size_t nr = 0;
+
+#define ADD_STRING(str) \
+  iov[nr].iov_base = (char *) str;					      \
+  iov[nr].iov_len = strlen (str);					      \
+  ++nr
+#define ADD_MEM(str, len) \
+  iov[nr].iov_base = str;						      \
+  iov[nr].iov_len = len;						      \
+  ++nr
+
+  /* Generate strings of register contents.  */
+  hexvalue (ctx->uc_mcontext.sc_sr, regs[0], 8);
+  hexvalue (ctx->uc_mcontext.sc_pc, regs[1], 8);
+  hexvalue (ctx->uc_mcontext.sc_usp, regs[2], 8);
+  hexvalue (ctx->uc_mcontext.sc_r15, regs[3], 8);
+  hexvalue (ctx->uc_mcontext.sc_mask, regs[4], 8);
+  hexvalue (ctx->uc_mcontext.sc_a0, regs[5], 8);
+  hexvalue (ctx->uc_mcontext.sc_a1, regs[6], 8);
+  hexvalue (ctx->uc_mcontext.sc_a2, regs[7], 8);
+  hexvalue (ctx->uc_mcontext.sc_a3, regs[8], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[0], regs[9], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[1], regs[10], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[2], regs[11], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[3], regs[12], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[4], regs[13], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[5], regs[14], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[6], regs[15], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[7], regs[16], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[8], regs[17], 8);
+  hexvalue (ctx->uc_mcontext.sc_regs[9], regs[18], 8);
+#ifdef	__CSKYABIV2__
+  hexvalue (ctx->uc_mcontext.sc_exregs[0], regs[19], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[1], regs[20], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[2], regs[21], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[3], regs[22], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[4], regs[23], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[5], regs[24], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[6], regs[25], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[7], regs[26], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[8], regs[27], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[9], regs[28], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[10], regs[29], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[11], regs[30], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[12], regs[31], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[13], regs[32], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[14], regs[33], 8);
+  hexvalue (ctx->uc_mcontext.sc_exregs[15], regs[34], 8);
+#endif
+
+  /* Generate the output.  */
+  ADD_STRING ("Register dump:\n\n PSR: ");
+  ADD_MEM (regs[0], 8);
+  ADD_STRING ("  PC: ");
+  ADD_MEM (regs[1], 8);
+  ADD_STRING ("   SP: ");
+  ADD_MEM (regs[2], 8);
+  ADD_STRING ("   LR: ");
+  ADD_MEM (regs[3], 8);
+  ADD_STRING ("\n MASK: ");
+  ADD_MEM (regs[4], 8);
+  ADD_STRING ("\n\n A0: ");
+  ADD_MEM (regs[5], 8);
+  ADD_STRING ("   A1: ");
+  ADD_MEM (regs[6], 8);
+  ADD_STRING ("   A2: ");
+  ADD_MEM (regs[7], 8);
+  ADD_STRING ("   A3: ");
+  ADD_MEM (regs[8], 8);
+#ifdef __CSKYABIV2__
+  ADD_STRING ("\n R4: ");
+  ADD_MEM (regs[9], 8);
+  ADD_STRING ("   r5: ");
+  ADD_MEM (regs[10], 8);
+  ADD_STRING ("   r6: ");
+  ADD_MEM (regs[11], 8);
+  ADD_STRING ("   r7: ");
+  ADD_MEM (regs[12], 8);
+  ADD_STRING ("\n R8: ");
+  ADD_MEM (regs[13], 8);
+  ADD_STRING ("   R9: ");
+  ADD_MEM (regs[14], 8);
+  ADD_STRING ("   R10: ");
+  ADD_MEM (regs[15], 8);
+  ADD_STRING ("  R11: ");
+  ADD_MEM (regs[16], 8);
+  ADD_STRING ("\n R12: ");
+  ADD_MEM (regs[17], 8);
+  ADD_STRING ("  R13: ");
+  ADD_MEM (regs[18], 8);
+  ADD_STRING ("  R14: ");
+  ADD_MEM (regs[19], 8);
+  ADD_STRING ("  R15: ");
+  ADD_MEM (regs[20], 8);
+  ADD_STRING ("\n R16: ");
+  ADD_MEM (regs[21], 8);
+  ADD_STRING ("  R17: ");
+  ADD_MEM (regs[22], 8);
+  ADD_STRING ("  R18: ");
+  ADD_MEM (regs[23], 8);
+  ADD_STRING ("  R19: ");
+  ADD_MEM (regs[24], 8);
+  ADD_STRING ("\n R20: ");
+  ADD_MEM (regs[25], 8);
+  ADD_STRING ("  R21: ");
+  ADD_MEM (regs[26], 8);
+  ADD_STRING ("  R22: ");
+  ADD_MEM (regs[27], 8);
+  ADD_STRING ("  R23: ");
+  ADD_MEM (regs[28], 8);
+  ADD_STRING ("\n R24: ");
+  ADD_MEM (regs[29], 8);
+  ADD_STRING ("  R25: ");
+  ADD_MEM (regs[30], 8);
+  ADD_STRING ("  R26: ");
+  ADD_MEM (regs[31], 8);
+  ADD_STRING ("  R27: ");
+  ADD_MEM (regs[32], 8);
+  ADD_STRING ("\n R28: ");
+  ADD_MEM (regs[33], 8);
+  ADD_STRING ("  R29: ");
+  ADD_MEM (regs[34], 8);
+  ADD_STRING ("  R30: ");
+  ADD_MEM (regs[33], 8);
+  ADD_STRING ("  R31: ");
+  ADD_MEM (regs[34], 8);
+#else
+  ADD_STRING ("   R6: ");
+  ADD_MEM (regs[9], 8);
+  ADD_STRING ("   R7: ");
+  ADD_MEM (regs[10], 8);
+  ADD_STRING ("   R8: ");
+  ADD_MEM (regs[11], 8);
+  ADD_STRING ("   R9: ");
+  ADD_MEM (regs[12], 8);
+  ADD_STRING ("\n R10: ");
+  ADD_MEM (regs[13], 8);
+  ADD_STRING ("  R11: ");
+  ADD_MEM (regs[14], 8);
+  ADD_STRING ("  R12: ");
+  ADD_MEM (regs[15], 8);
+  ADD_STRING ("  R13: ");
+  ADD_MEM (regs[16], 8);
+  ADD_STRING ("\n R14: ");
+  ADD_MEM (regs[17], 8);
+  ADD_STRING ("  R1: ");
+  ADD_MEM (regs[18], 8);
+#endif
+
+  ADD_STRING ("\n");
+
+  /* Write the stuff out.  */
+  writev (fd, iov, nr);
+}
+
+#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/csky/setcontext.S b/sysdeps/unix/sysv/linux/csky/setcontext.S
new file mode 100644
index 0000000..199a07f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/setcontext.S
@@ -0,0 +1,128 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __CSKYABIV2__
+# include "abiv2_setcontext.S"
+#else
+
+# include <sysdep.h>
+
+# include "ucontext_i.h"
+
+/* int setcontext (const ucontext_t *ucp) */
+
+ENTRY(__setcontext)
+	mov	r7, r2
+
+	/* set sigmask */
+	movi	r2, SIG_SETMASK
+	lrw	r3, UCONTEXT_SIGMASK
+	add	r3, r7
+	movi	r4, 0
+
+	subi	sp, 8
+	stw	r7, (sp, 0)	/* save r7(ucp) */
+
+        /* do sigprocmask syscall */
+# ifdef __PIC__
+	subi	sp, 8
+	stw	gb, (sp, 0)
+	stw	lr, (sp, 4)
+	bsr	.Lgetpc1
+.Lgetpc1:
+	lrw	gb, .Lgetpc1@GOTPC
+	addu	gb, r15
+	lrw	r7, __sigprocmask@PLT
+	addu	r7, gb
+	ldw	r7, (r7)
+	jsr	r7
+	ldw	gb, (sp, 0)
+	ldw	lr, (sp, 4)
+	addi	sp, 8
+# else
+	jsri	__sigprocmask
+# endif /* __PIC__ */
+
+	ldw	r1, (sp, 0)	/* restore r7(ucp) */
+	addi	sp, 8
+
+	lrw	r2, MCONTEXT_CSKY_A0
+	add	r2, r1
+
+	/* set r2-r14. Load r2-r7, for makecontext requires */
+	ldw	r3, (r2, 4)
+	ldw	r4, (r2, 8)
+	ldw	r5, (r2, 12)
+	ldw	r6, (r2, 16)
+	ldw	r7, (r2, 20)
+	ldw	r8, (r2, 24)
+	ldw	r9, (r2, 28)
+	ldw	r10, (r2, 32)
+	ldw	r11, (r2, 36)
+	ldw	r12, (r2, 40)
+	ldw	r13, (r2, 44)
+	ldw	r14, (r2, 48)
+
+	ldw	r15, (r2, 56)			/* load lr */
+
+	lrw	r2, MCONTEXT_CSKY_SP
+	add	r2, r1
+	ldw	sp, (r2)			/* load sp */
+
+	lrw	r2, MCONTEXT_CSKY_PC
+	add	r2, r1
+	ldw	r2, (r2)			/* load start addr */
+
+	subi	sp, 8				/* for getcontext success */
+	stw	r2, (sp, 0)
+	lrw	r2, MCONTEXT_CSKY_A0
+	add	r2, r1
+	ldw	r2, (r2)			/* load a0 */
+	ldw	r1, (sp, 0)
+	addi	sp, 8
+
+	jmp	r1
+END(setcontext)
+weak_alias(__setcontext, setcontext)
+
+ENTRY(__startcontext)
+	mov	a0, r9
+	cmpnei	r9, 0		/* r9 was set in makecontext */
+	bf	1f		/* null, then exit */
+
+	/* call setcontext */
+# ifdef __PIC__
+	mov	r5, r15		/* save r15 */
+	bsr	.Lgetpc2
+.Lgetpc2:
+	lrw	r6, .Lgetpc2@GOTPC
+	addu	r6, r15
+	lrw	r7, __setcontext@GOT
+	addu	r7, r6
+	ldw	r7, (r7)
+	mov	r15, r5		/* restore r15 */
+# else
+	lrw	r7, __setcontext
+# endif
+	jsr	r7
+
+1:
+	lrw	r1, __NR_exit
+	trap	0
+END(__startcontext)
+
+#endif	/* __CSKYAVBI2__*/
diff --git a/sysdeps/unix/sysv/linux/csky/shlib-versions b/sysdeps/unix/sysv/linux/csky/shlib-versions
new file mode 100644
index 0000000..6c1ca16
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/shlib-versions
@@ -0,0 +1,3 @@
+DEFAULT			GLIBC_2.27
+
+ld=ld.so.1
diff --git a/sysdeps/unix/sysv/linux/csky/sigcontextinfo.h b/sysdeps/unix/sysv/linux/csky/sigcontextinfo.h
new file mode 100644
index 0000000..ba69f36
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/sigcontextinfo.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define SIGCONTEXT siginfo_t *_si, struct ucontext *
+#define SIGCONTEXT_EXTRA_ARGS _si,
+#define GET_PC(ctx)	((void *) (ctx)->uc_mcontext.sc_pc)
+/* r8 is fp, make sure it is in the same area in sigcontext.  */
+#define GET_FRAME(ctx)	((void *) (ctx)->uc_mcontext.sc_regs[2])
+#define GET_STACK(ctx)	((void *) (ctx)->uc_mcontext.sc_usp)
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
+
+/* There is no reliable way to get the sigcontext unless we use a
+   three-argument signal handler.  */
+#define __sigaction(sig, act, oact) ({ \
+  (act)->sa_flags |= SA_SIGINFO; \
+  (__sigaction) (sig, act, oact); \
+})
+
+#define sigaction(sig, act, oact) ({ \
+  (act)->sa_flags |= SA_SIGINFO; \
+  (sigaction) (sig, act, oact); \
+})
diff --git a/sysdeps/unix/sysv/linux/csky/swapcontext.S b/sysdeps/unix/sysv/linux/csky/swapcontext.S
new file mode 100644
index 0000000..db3c2f8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/swapcontext.S
@@ -0,0 +1,112 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
+
+ENTRY(swapcontext)
+	/* save params and lr */
+	subi	sp, 16
+	stw	a0, (sp, 0)
+	stw	a1, (sp, 4)
+	stw	r15, (sp, 8)
+
+	/* call getcontext */
+#ifdef __PIC__
+# ifdef __CSKYABIV2__
+	grs	t1, .Lgetpc1
+.Lgetpc1:
+	lrw	t0, .Lgetpc1@GOTPC
+	addu	t1, t1, t0
+	lrw	t0, __getcontext@GOT
+	ldr.w	t0, (t1, t0 << 0)
+	jsr	t0
+# else /* __CSKYABIV1 */
+	mov	r7, lr
+	bsr	.Lgetpc1
+.Lgetpc1:	/* do not use gb here, and restore lr before call getcontext*/
+	lrw	r6, .Lgetpc1@GOTPC
+	addu	r6, r15
+	mov	lr, r7	/* restore r15 */
+	lrw	r5, __getcontext@GOT
+	addu	r5, r6
+	ldw	r5, (r5)
+	jsr	r5
+# endif
+#else /* no pic */
+	jsri	 __getcontext
+#endif
+
+	mov	a3, a0	/* save return value */
+
+	/* restore params and lr */
+	ldw	a0, (sp, 0)
+	ldw	a1, (sp, 4)
+	ldw	r15, (sp, 8)
+	addi	sp, 16
+
+	cmpnei	a3, 0
+	bt	error_exit
+
+	/* Fix up LR and the PC */
+#ifdef	__CSKYABIV2__
+	stw	sp, (a0, MCONTEXT_CSKY_SP)
+	stw	r15, (a0, MCONTEXT_CSKY_LR)
+	stw	r15, (a0, MCONTEXT_CSKY_PC)
+#else
+	lrw	r4, MCONTEXT_CSKY_SP
+	add	r4, a0
+	stw	sp, (r4)
+	lrw	r4, MCONTEXT_CSKY_LR
+	add	r4, a0
+	stw	r15, (r4)
+	stw	r15, (r4, 8)	/* MCONTEXT_CSKY_PC */
+#endif
+
+	/* set setcontext's arg */
+	mov	a0, a1
+
+#ifdef __PIC__
+# ifdef __CSKYABIV2__
+	grs	t1, .Lgetpc2
+.Lgetpc2:
+	lrw	a3, .Lgetpc2@GOTPC
+	addu	t1, t1, a3
+	lrw	a3, __setcontext@GOT
+	ldr.w	a3, (t1, a3 << 0)
+# else
+	mov	r7, r15		/* save r15 */
+	bsr	.Lgetpc2
+.Lgetpc2:
+	lrw	r6, .Lgetpc2@GOTPC
+	addu	r6, r15
+	lrw	r5, __setcontext@GOT
+	addu	r5, r6
+	ldw	r5, (r5)
+	mov	r15, r7		/* restore r15 */
+# endif /* __CSKYABIV2__ */
+#else /* __PIC__ */
+	lrw	a3, __setcontext
+#endif /* __PIC__ */
+	jmp	a3
+
+error_exit:
+	jmp	r15
+END(swapcontext)
diff --git a/sysdeps/unix/sysv/linux/csky/sys/cachectl.h b/sysdeps/unix/sysv/linux/csky/sys/cachectl.h
new file mode 100644
index 0000000..1aeacde
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/sys/cachectl.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H 1
+
+#include <features.h>
+
+/* Get the kernel definition for the op bits.  */
+#include <asm/cachectl.h>
+
+__BEGIN_DECLS
+
+#ifdef __USE_MISC
+extern int cacheflush (void *__addr, const int __nbytes, const int __op) __THROW;
+#endif
+extern int _flush_cache (char *__addr, const int __nbytes, const int __op) __THROW;
+
+__END_DECLS
+
+#endif /* sys/cachectl.h */
diff --git a/sysdeps/unix/sysv/linux/csky/sys/procfs.h b/sysdeps/unix/sysv/linux/csky/sys/procfs.h
new file mode 100644
index 0000000..4c9721b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/sys/procfs.h
@@ -0,0 +1,123 @@
+/* Core image file related definitions, C-SKY version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H	1
+
+/* This is somewhat modelled after the file of the same name on SVR4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  It doesn't have anything to do with the /proc file
+   system, even though Linux has one.
+
+   Anyway, the whole purpose of this file is for GDB and GDB only.
+   Don't read too much into it.  Don't use it for anything other than
+   GDB unless you know what you are doing.  */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register.  */
+typedef unsigned long elf_greg_t;
+
+/* And the whole bunch of them.  We could have used `struct
+   user_regs' directly in the typedef, but tradition says that
+   the register set is an array, which does have some peculiar
+   semantics, so leave it that way.  */
+#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+/* Register set for the floating-point registers.  */
+typedef struct user_fpregs elf_fpregset_t;
+
+/* Signal info.  */
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with Linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   GDB doesn't really use excluded.  */
+
+struct elf_prstatus
+  {
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned short int pr_uid;
+    unsigned short int pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+/* The rest of this file provides the types for emulation of the
+   Solaris <proc_service.h> interfaces that should be implemented by
+   users of libthread_db.  */
+
+/* Addresses.  */
+typedef void *psaddr_t;
+
+/* Register sets.  Linux has different names.  */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+   therefore have only one PID type.  */
+typedef __pid_t lwpid_t;
+
+/* Process status and info.  In the end we do provide typedefs for them.  */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h b/sysdeps/unix/sysv/linux/csky/sys/ucontext.h
new file mode 100644
index 0000000..a9c856e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/sys/ucontext.h
@@ -0,0 +1,111 @@
+/* System V/C-SKY ABI compliant context switching support.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+#include <bits/sigcontext.h>
+#include <bits/types/sigset_t.h>
+#include <bits/types/stack_t.h>
+
+/* Type for general register.  */
+typedef int greg_t;
+
+/* Number of general registers.  */
+#if (__CSKY__ == 2)
+#define NGREG   34
+#else
+#define NGREG   18
+#endif
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  R_R0 = 0,
+#define R_R0    R_R0
+  R_R1 = 1,
+#define R_R1    R_R1
+  R_R2 = 2,
+#define R_R2    R_R2
+  R_R3 = 3,
+#define R_R3    R_R3
+  R_R4 = 4,
+#define R_R4    R_R4
+  R_R5 = 5,
+#define R_R5    R_R5
+  R_R6 = 6,
+#define R_R6    R_R6
+  R_R7 = 7,
+#define R8R7    R_R7
+  R_R8 = 8,
+#define R_R8    R_R8
+  R_R9 = 9,
+#define R_R9    R_R9
+  R_R10 = 10,
+#define R_R10   R_R10
+  R_R11 = 11,
+#define R_R11   R_R11
+  R_R12 = 12,
+#define R_R12   R_R12
+  R_R13 = 13,
+#define R_R13   R_R13
+  R_R14 = 14,
+#define R_R14   R_R14
+  R_R15 = 15,
+#define R_R15   R_R15
+#if (__CSKY__ == 2)
+  R_SR = 32,
+#define R_SR    R_SR
+  R_PC = 33,
+#define R_PC    R_PC
+#else
+  R_SR = 16,
+#define R_SR    R_SR
+  R_PC = 17,
+#define R_PC    R_PC
+#endif
+};
+
+/* Structure to describe FPU registers.  */
+typedef struct fpregset
+{
+  unsigned long  fesr;        /* fpu exception status reg */
+  unsigned long  fsr;         /* fpu status reg, nothing in CPU_CSKYV2 */
+  unsigned long  fp[32];      /* fpu general regs */
+} fpregset_t;
+
+/* store common registers and fp registers etc. */
+typedef struct sigcontext mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+{
+  unsigned long uc_flags;
+  struct ucontext *uc_link;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;	/* struct sigcontext */
+  __sigset_t uc_sigmask;
+  unsigned long uc_filler[80];
+} ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/csky/sys/user.h b/sysdeps/unix/sysv/linux/csky/sys/user.h
new file mode 100644
index 0000000..e969d60
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/sys/user.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_USER_H
+#define _SYS_USER_H  1
+
+struct user_fpregs {
+  unsigned long fsr;		/* fpu status reg */
+  unsigned long fesr;		/* fpu exception status reg */
+  unsigned long fp[32];		/* fpu general regs */
+};
+
+struct user_regs {
+#if defined(__ck807__) || defined(__ck810__) || defined(__ck860__)
+  unsigned long int uregs[34];	/* CSKY V2 has 32 general rgister */
+#else
+  unsigned long int uregs[18];	/* CSKY V1 has 16 general rgister */
+#endif
+};
+
+/*
+ * When the kernel dumps core, it starts by dumping the user struct -
+ * this will be used by gdb to figure out where the data and stack segments
+ * are within the file, and what virtual addresses to use.
+ */
+struct user{
+/* We start with the registers, to mimic the way that "memory" is returned
+   from the ptrace(3,...) function.  */
+  struct user_regs    regs;	   /* The registers are actually stored */
+  int                 u_fpvalid;   /* True if math co-processor being used. */
+
+/* The rest of this junk is to help gdb figure out what goes where */
+  unsigned long int   u_tsize;	   /* Text segment size (pages). */
+  unsigned long int   u_dsize;	   /* Data segment size (pages). */
+  unsigned long int   u_ssize;	   /* Stack segment size (pages). */
+  unsigned long       start_code;  /* Starting virtual address of text. */
+  unsigned long       start_stack; /* Starting virtual address of stack area.
+				      This is actually the bottom of the stack
+				      the top of the stack is always found in
+				      the esp register.  */
+  long int            signal;	   /* Signal that caused the core dump. */
+  int                 reserved;	   /* No longer used */
+  struct user_regs *  u_ar0;	   /* Used by gdb to help find the values
+				      for the registers. */
+  unsigned long       magic;	   /* To uniquely identify a core file */
+  char                u_comm[32];  /* User command that was responsible */
+  struct user_fpregs  u_fp;
+  struct user_fpregs* u_fpstate;   /* Math Co-processor pointer. */
+};
+
+#endif /* _SYS_USER_H */
diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.S b/sysdeps/unix/sysv/linux/csky/sysdep.S
new file mode 100644
index 0000000..44496d5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/sysdep.S
@@ -0,0 +1,110 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#include <csky_readtp.h>
+
+/* The syscall stubs jump here when they detect an error.
+   The code for Linux is almost identical to the canonical Unix
+   code, except that the error number in R0 is negated.  */
+
+#undef CALL_MCOUNT
+#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers R0.  */
+
+	.text
+ENTRY(__syscall_error)
+	movi	a1, 0
+	rsub	a0, a0, a1
+
+#ifdef __CSKYABIV2__
+1:
+# if !IS_IN (rtld)
+	mov	a1, a0
+        csky_read_tp
+
+        grs     t1, .Lgetpc1
+.Lgetpc1:
+        lrw     t0, errno@gottpoff
+        add     t1, t1, t0
+        ldw     t1, (t1)
+        add     t1, a0
+        stw     a1, (t1)
+        bmaski  a0, 0
+        rts
+# elif RTLD_PRIVATE_ERRNO /* !IS_IN (rtld) */
+#  ifdef  __PIC__
+        grs     t1, .Lgetpc2
+.Lgetpc2:
+        lrw     t0, .Lgetpc2@GOTPC
+        addu    t1, t1, t0
+        lrw     t0, rtld_errno@PLT
+        ldr.w   t0, (t1, t0 << 0)
+#  else
+        lrw     t0, rtld_errno
+#  endif /* __PIC__ */
+        stw     a0, (t0)
+        bmaski  a0, 0
+        rts
+# else
+#  error "Unsupported non-TLS case"
+# endif /* RTLD_PRIVATE_ERRNO */
+
+# undef  __syscall_error
+END (__syscall_error)
+
+#else /* __CSKYABIV2__ */
+
+1:
+# if !IS_IN (rtld)
+        mov     r7, r15
+	mov	r1, r2
+        csky_read_tp
+
+        bsr     .Lgetpc1
+.Lgetpc1:
+        lrw     r5, errno@gottpoff
+        add     r5, r15
+        ldw     r5, (r5)
+        add     r5, r2
+        stw     r1, (r5)
+        bmaski  r2, 0
+	mov	r15, r7
+        rts
+# elif RTLD_PRIVATE_ERRNO /* !IS_IN (rtld) */
+#  ifdef __PIC__
+        mov     r7, r15
+        bsr     .Lgetpc2
+.Lgetpc2:
+        lrw     r6, .Lgetpc2@GOTPC
+        addu    r6, r15
+        lrw     r5, rtld_errno@PLT
+        addu    r5, r6
+        ldw     r5, (r5)
+	mov	r15, r7
+#  else /* __PIC__ */
+        lrw     r5, rtld_errno
+#  endif /* __PIC__ */
+        stw     r2, (r5)
+        bmaski  r2, 0
+        rts
+# else
+#  error "Unsupported non-TLS case"
+# endif /* RTLD_PRIVATE_ERRNO */
+
+END (__syscall_error)
+
+#endif /* __CSKYABIV2__ */
diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.h b/sysdeps/unix/sysv/linux/csky/sysdep.h
new file mode 100644
index 0000000..05013db
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/sysdep.h
@@ -0,0 +1,757 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _LINUX_CSKY_SYSDEP_H
+#define _LINUX_CSKY_SYSDEP_H 1
+
+/* There is some commonality.  */
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
+#include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/csky/sysdep.h>
+
+/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
+#include <dl-sysdep.h>
+
+#include <tls.h>
+
+/* In order to get __set_errno() definition in INLINE_SYSCALL.  */
+#ifndef __ASSEMBLER__
+# include <errno.h>
+#endif
+
+#undef SYS_ify
+#define SYS_ify(syscall_name)  (__NR_##syscall_name)
+
+#ifdef __ASSEMBLER__
+/* Linux uses a negative return value to indicate syscall errors,
+   unlike most Unices, which use the condition codes' carry flag.
+
+   Since version 2.1 the return value of a system call might be
+   negative even if the call succeeded.  E.g., the `lseek' system call
+   might return a large offset.  Therefore we must not anymore test
+   for < 0, but test for a real error by making sure the value in R0
+   is a real error number.  Linus said he will make sure the no syscall
+   returns a value in -1 .. -4095 as a valid result so we can safely
+   test with -4095.  */
+
+# undef	PSEUDO
+# define	PSEUDO(name, syscall_name, args)	\
+  .text;						\
+  ENTRY (name);						\
+    DO_CALL (syscall_name, args);
+
+
+# if defined (__PIC__)
+#  define __GET_GB1  \
+	bsr getgb; getgb: lrw gb, getgb@GOTPC; addu gb, lr;
+# else
+#  define __GET_GB1
+# endif /* !__PIC__ */
+
+# undef  PSEUDO_RET
+# ifdef __PIC__
+#  if !IS_IN (libc)
+#   define PSEUDO_RET	\
+	btsti  a0, 31;					\
+	bf	   1f;					\
+	subi sp, 8; st.w lr, (sp); st.w gb, (sp, 4);	\
+	__GET_GB1					\
+	bsr    SYSCALL_ERROR;				\
+	ld.w lr, (sp); ld.w gb, (sp, 4); addi sp, 8;	\
+1:							\
+    rts
+#  else
+#   define PSEUDO_RET	\
+	btsti  a0, 31;					\
+	bf    2f;					\
+	subi sp, 8; st.w lr, (sp); st.w gb, (sp, 4);	\
+	__GET_GB1;					\
+	lrw   a2, SYSCALL_ERROR@PLT;			\
+	add   a2, gb;					\
+	ld.w  a2, (a2);					\
+	jsr   a2;					\
+	ld.w lr, (sp); ld.w gb, (sp, 4); addi sp, 8;	\
+2:							\
+	rts
+#  endif /* IS_IN (libc) */
+# else
+#  if !IS_IN (libc)
+#   define PSEUDO_RET		\
+	btsti  a0, 31;		\
+	bt     SYSCALL_ERROR;	\
+	rts
+#  else
+#   define PSEUDO_RET				\
+	btsti  a0, 31;				\
+	bf     3f;				\
+	jmpi   SYSCALL_ERROR;			\
+3:						\
+	rts
+#  endif /* !IS_IN (libc) */
+# endif /* __PIC__ */
+
+
+# undef ret
+# define ret PSEUDO_RET
+
+# undef	PSEUDO_END
+# define PSEUDO_END(name)	\
+  .align 4;			\
+  SYSCALL_ERROR_HANDLER;	\
+  END (name)
+
+# undef	PSEUDO_NOERRNO
+# define PSEUDO_NOERRNO(name, syscall_name, args)	\
+  .text;				\
+  ENTRY (name);				\
+    DO_CALL (syscall_name, args)
+
+# define PSEUDO_RET_NOERRNO \
+	jmp     r15;
+
+# undef ret_NOERRNO
+# define ret_NOERRNO PSEUDO_RET_NOERRNO
+
+# undef	PSEUDO_END_NOERRNO
+# define PSEUDO_END_NOERRNO(name)	\
+	END (name)
+
+/* The function has to return the error code.  */
+# undef	PSEUDO_ERRVAL
+# define PSEUDO_ERRVAL(name, syscall_name, args)	\
+  .text;				\
+  ENTRY (name)				\
+    DO_CALL (syscall_name, args);	\
+    not  a0;				\
+    addi a0, 1
+
+# undef	PSEUDO_END_ERRVAL
+# define PSEUDO_END_ERRVAL(name) \
+  END (name)
+
+# define ret_ERRVAL rts
+
+# if !IS_IN (libc)
+#  define SYSCALL_ERROR __local_syscall_error
+#  if RTLD_PRIVATE_ERRNO
+#   ifdef __PIC__
+#    define SYSCALL_ERROR_HANDLER	\
+__local_syscall_error:			\
+        lrw     a1, rtld_errno@PLT; 	\
+        addu	a1, gb;			\
+        ldw     a1, (a1);		\
+        rsubi   a0, 0;			\
+        stw     a0, (a1);		\
+        bmaski  a0, 0;			\
+        rts
+#   else /* __PIC__ */
+#    define SYSCALL_ERROR_HANDLER	\
+__local_syscall_error:			\
+        lrw     a1, rtld_errno;		\
+        rsubi   a0, 0;			\
+        stw     a0, (a1);		\
+        bmaski  a0, 0;			\
+        rts
+#   endif /* __PIC__ */
+#  else /* !RTLD_PRIVATE_ERRNO */
+#    ifdef __PIC__
+#     define SYSCALL_ERROR_HANDLER	\
+__local_syscall_error:				\
+        subi    sp, 8;				\
+        stw     a0, (sp, 0);			\
+        stw     r15, (sp, 4);			\
+        lrw     a1, __errno_location@PLT;	\
+	add	a1, gb;				\
+        ldw     a1, (a1);			\
+        jsr     a1;				\
+        ldw     a1, (sp, 0); /* load errno*/	\
+        ldw     r15, (sp, 4);			\
+        addi    sp, 8;				\
+        movi    a2, 0;				\
+        rsub    a1, a1, a2;			\
+        stw     a1, (a0);			\
+        bmaski  a0, 0;				\
+        rts
+#    else
+#     define SYSCALL_ERROR_HANDLER 	\
+__local_syscall_error:                                          \
+        subi    sp, 8;                                          \
+        stw     a0, (sp, 0);                                    \
+        stw     r15, (sp, 4);                                   \
+        lrw     a1, __errno_location;                           \
+        jsr     a1;                                             \
+        ldw     a1, (sp, 0);  /* load errno */                  \
+        ldw     r15, (sp, 4);                                   \
+        addi    sp, 8;                                          \
+        movi    a2, 0;                                          \
+        rsub    a1, a1, a2;                                     \
+        stw     a1, (a0);                                       \
+        bmaski  a0, 0;                                          \
+        rts
+#   endif /* __PIC__ */
+#  endif/* RTLD_PRIVATE_ERROR */
+# else
+#  define SYSCALL_ERROR_HANDLER  /* Nothing here; code in sysdep.S is used.  */
+#  define SYSCALL_ERROR __syscall_error
+# endif/* IS_IN (libc) */
+
+/* define DO_CALL */
+#ifdef __CSKYABIV2__
+#undef	DO_CALL
+#define DO_CALL(syscall_name, args)		\
+    DOARGS_##args;				\
+    lrw  r7, SYS_ify(syscall_name);		\
+    trap 0;					\
+    UNDOARGS_##args
+
+#undef  DOARGS_0
+#define DOARGS_0    \
+  subi sp, 8;       \
+  cfi_adjust_cfa_offset (8); \
+  stw  r7, (sp, 0);  \
+  cfi_rel_offset (r7, 0);
+
+#undef  DOARGS_1
+#define DOARGS_1 DOARGS_0
+#undef  DOARGS_2
+#define DOARGS_2 DOARGS_0
+#undef  DOARGS_3
+#define DOARGS_3 DOARGS_0
+#undef  DOARGS_4
+#define DOARGS_4 DOARGS_0
+#undef  DOARGS_5
+#define DOARGS_5    \
+  subi sp, 8;       \
+  cfi_adjust_cfa_offset (8); \
+  stw  r7, (sp, 0); \
+  cfi_rel_offset (7, 0); \
+  stw  r4, (sp, 4); \
+  cfi_rel_offset (4, 4); \
+  ldw  r4, (sp, 8)
+#undef  DOARGS_6
+#define DOARGS_6    \
+  subi sp, 16;      \
+  cfi_adjust_cfa_offset (16); \
+  stw  r7, (sp, 0); \
+  cfi_rel_offset (7, 0); \
+  stw  r4, (sp, 4); \
+  cfi_rel_offset (4, 4); \
+  stw  r5, (sp, 8); \
+  cfi_rel_offset (5, 8); \
+  ldw  r4, (sp, 16); \
+  ldw  r5, (sp, 20)
+
+#undef  UNDOARGS_0
+#define UNDOARGS_0 \
+  ldw  r7, (sp, 0); \
+  cfi_restore (r7); \
+  addi sp, 8;   \
+  cfi_adjust_cfa_offset (-8);
+
+#undef  UNDOARGS_1
+#define UNDOARGS_1 UNDOARGS_0
+#undef  UNDOARGS_2
+#define UNDOARGS_2 UNDOARGS_0
+#undef  UNDOARGS_3
+#define UNDOARGS_3 UNDOARGS_0
+#undef  UNDOARGS_4
+#define UNDOARGS_4 UNDOARGS_0
+#undef  UNDOARGS_5
+#define UNDOARGS_5  \
+  ldw  r7, (sp, 0); \
+  cfi_restore (r4); \
+  ldw  r4, (sp, 4); \
+  cfi_restore (r4); \
+  addi sp, 8;  \
+  cfi_adjust_cfa_offset (-8);
+
+#undef  UNDOARGS_6
+#define UNDOARGS_6 \
+  ldw  r7, (sp, 0); \
+  cfi_restore (r7); \
+  ldw  r4, (sp, 4); \
+  cfi_restore (r4); \
+  ldw  r5, (sp, 8); \
+  cfi_restore (r5); \
+  addi sp, 16;    \
+  cfi_adjust_cfa_offset (-16);
+
+#else	/* __CSKYABIV1__ */
+
+#undef  DO_CALL
+#define DO_CALL(syscall_name, args)             \
+    lrw  r1, SYS_ify(syscall_name);            \
+    trap 0
+//#endif	/* DO_CALL */
+#endif	/* __CSKYABIV2__ */
+
+/* define DO_CALL_2, only ABIV2 need DO_CALL_2 */
+#ifdef __CSKYABIV2__
+
+#undef	DO_CALL_2
+#define DO_CALL_2(syscall_name, args)		\
+    DOARGS2_##args;				\
+    lrw  r7, SYS_ify(syscall_name);		\
+    trap 0;					\
+    UNDOARGS2_##args
+
+/*
+ * to be quite different with DO_CALL, DO_CALL_2 need not save r7.
+ */
+#undef  DOARGS2_0
+#define DOARGS2_0
+
+#undef  DOARGS2_1
+#define DOARGS2_1 DOARGS2_0
+#undef  DOARGS2_2
+#define DOARGS2_2 DOARGS2_0
+#undef  DOARGS2_3
+#define DOARGS2_3 DOARGS2_0
+#undef  DOARGS2_4
+#define DOARGS2_4 DOARGS2_0
+#undef  DOARGS2_5
+#define DOARGS2_5   \
+  subi sp, 8;       \
+  cfi_adjust_cfa_offset (8); \
+  stw  r4, (sp, 0); \
+  cfi_rel_offset (4, 0); \
+  ldw  r4, (sp, 20)
+#undef  DOARGS2_6
+#define DOARGS2_6    \
+  subi sp, 8;       \
+  cfi_adjust_cfa_offset (8); \
+  stw  r4, (sp, 0); \
+  cfi_rel_offset (4, 0); \
+  stw  r5, (sp, 4); \
+  cfi_rel_offset (5, 0); \
+  ldw  r4, (sp, 20); \
+  ldw  r5, (sp, 24)
+
+#undef  UNDOARGS2_0
+#define UNDOARGS2_0
+
+#undef  UNDOARGS2_1
+#define UNDOARGS2_1 UNDOARGS2_0
+#undef  UNDOARGS2_2
+#define UNDOARGS2_2 UNDOARGS2_0
+#undef  UNDOARGS2_3
+#define UNDOARGS2_3 UNDOARGS2_0
+#undef  UNDOARGS2_4
+#define UNDOARGS2_4 UNDOARGS2_0
+#undef  UNDOARGS2_5
+#define UNDOARGS2_5  \
+  ldw  r4, (sp, 0); \
+  addi sp, 8
+
+#undef  UNDOARGS2_6
+#define UNDOARGS2_6 \
+  ldw  r4, (sp, 0); \
+  ldw  r5, (sp, 4); \
+  addi sp, 8
+
+#endif  /* DO_CALL_2 */
+
+#else /* not __ASSEMBLER__ */
+
+
+/* Define a macro which expands into the inline wrapper code for a system
+   call.  */
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...)                               \
+  ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args);     \
+     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \
+       {                                                                \
+         __set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, ));           \
+         _inline_sys_result = (unsigned int) -1;                                \
+       }                                                                \
+     (int) _inline_sys_result; })
+
+#undef INTERNAL_SYSCALL_DECL
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+  ((unsigned int) (val) >= 0xffffff01u)
+
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val, err)        (-(val))
+
+
+#undef INTERNAL_SYSCALL_RAW
+#ifndef __CSKYABIV2__
+#define INTERNAL_SYSCALL_RAW0(name, err, dummy...)                      \
+  ({unsigned int __sys_result;                                          \
+     {                                                                  \
+       register int _a1 __asm__ ("a0"), _nr __asm__ ("r1");             \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr)                                \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW1(name, err, arg1)                          \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1);                               \
+     {                                                                  \
+       register int _a1 __asm__ ("a0"), _nr __asm__ ("r1");             \
+       _a1 = _tmp_arg1;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1)                     \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW2(name, err, arg1, arg2)                    \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+     {                                                                  \
+       register int _nr __asm__ ("r1");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2;                                \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2)          \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW3(name, err, arg1, arg2, arg3)              \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3);                               \
+     {                                                                  \
+       register int _nr __asm__ ("r1");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2");                                 \
+       _a1 = _tmp_arg1;                                                 \
+       _a2 = _tmp_arg2;                                                 \
+       _a3 = _tmp_arg3;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3)                                \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW4(name, err, arg1, arg2, arg3, arg4)        \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+     {                                                                  \
+       register int _nr __asm__ ("r1");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4)                     \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW5(name, err, arg1, arg2, arg3, arg4,        \
+                              arg5)                                     \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+    register int _tmp_arg5 = (int)(arg5);                               \
+     {                                                                  \
+       register int _nr __asm__ ("r1");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       register int _a5 __asm__ ("a4");                                 \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4, _a5 = _tmp_arg5;                                \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4), "r" (_a5)          \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW6(name, err, arg1, arg2, arg3, arg4,        \
+                              arg5, arg6)                               \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+    register int _tmp_arg5 = (int)(arg5), _tmp_arg6 = (int)(arg6);      \
+     {                                                                  \
+       register int _nr __asm__ ("r1");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       register int _a5 __asm__ ("a4"), _a6 __asm__ ("a5");             \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4, _a5 = _tmp_arg5, _a6 = _tmp_arg6;               \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4), "r" (_a5),         \
+                               "r" (_a6)                                \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW7(name, err, arg1, arg2, arg3, arg4,        \
+                              arg5, arg6, arg7)                         \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+    register int _tmp_arg5 = (int)(arg5), _tmp_arg6 = (int)(arg6);      \
+    register int _tmp_arg7 = (int)(arg7);                               \
+     {                                                                  \
+       register int _nr __asm__ ("r1");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       register int _a5 __asm__ ("a4"), _a6 __asm__ ("a5");             \
+       register int _a7 __asm__ ("r8");                                 \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4, _a5 = _tmp_arg5, _a6 = _tmp_arg6;               \
+       _a7 = _tmp_arg7;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4), "r" (_a5),         \
+                               "r" (_a6), "r" (_a7)                     \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#else
+#define INTERNAL_SYSCALL_RAW0(name, err, dummy...)                      \
+  ({unsigned int __sys_result;                                          \
+     {                                                                  \
+       register int _a1 __asm__ ("a0"), _nr __asm__ ("r7");             \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr)                                \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW1(name, err, arg1)                          \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1);                               \
+     {                                                                  \
+       register int _a1 __asm__ ("a0"), _nr __asm__ ("r7");             \
+       _a1 = _tmp_arg1;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1)                     \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW2(name, err, arg1, arg2)                    \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+     {                                                                  \
+       register int _nr __asm__ ("r7");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2;                                \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2)          \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW3(name, err, arg1, arg2, arg3)              \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3);                               \
+     {                                                                  \
+       register int _nr __asm__ ("r7");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2");                                 \
+       _a1 = _tmp_arg1;                                                 \
+       _a2 = _tmp_arg2;                                                 \
+       _a3 = _tmp_arg3;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3)                                \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW4(name, err, arg1, arg2, arg3, arg4)        \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+     {                                                                  \
+       register int _nr __asm__ ("r7");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4)                     \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW5(name, err, arg1, arg2, arg3, arg4,        \
+                              arg5)                                     \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+    register int _tmp_arg5 = (int)(arg5);                               \
+     {                                                                  \
+       register int _nr __asm__ ("r7");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       register int _a5 __asm__ ("r4");                                 \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4, _a5 = _tmp_arg5;                                \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4), "r" (_a5)          \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW6(name, err, arg1, arg2, arg3, arg4,        \
+                              arg5, arg6)                               \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+    register int _tmp_arg5 = (int)(arg5), _tmp_arg6 = (int)(arg6);      \
+     {                                                                  \
+       register int _nr __asm__ ("r7");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       register int _a5 __asm__ ("r4"), _a6 __asm__ ("r5");             \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4, _a5 = _tmp_arg5, _a6 = _tmp_arg6;               \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4), "r" (_a5),         \
+                               "r" (_a6)                                \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#define INTERNAL_SYSCALL_RAW7(name, err, arg1, arg2, arg3, arg4,        \
+                              arg5, arg6, arg7)                         \
+  ({unsigned int __sys_result;                                          \
+    register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2);      \
+    register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4);      \
+    register int _tmp_arg5 = (int)(arg5), _tmp_arg6 = (int)(arg6);      \
+    register int _tmp_arg7 = (int)(arg7);                               \
+     {                                                                  \
+       register int _nr __asm__ ("r7");                                 \
+       register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1");             \
+       register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3");             \
+       register int _a5 __asm__ ("r4"), _a6 __asm__ ("r5");             \
+       register int _a7 __asm__ ("r6");                                 \
+       _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3;               \
+       _a4 = _tmp_arg4, _a5 = _tmp_arg5, _a6 = _tmp_arg6;               \
+       _a7 = _tmp_arg7;                                                 \
+       _nr = name;                                                      \
+       __asm__ __volatile__ ("trap  0 \n\t"                             \
+                             : "=r" (_a1)                               \
+                             : "r" (_nr), "r" (_a1), "r" (_a2),         \
+                               "r" (_a3), "r" (_a4), "r" (_a5),         \
+                               "r" (_a6), "r" (_a7)                     \
+                             : "memory");                               \
+               __sys_result = _a1;                                      \
+     }                                                                  \
+     (int) __sys_result; })
+
+#endif /* __ABI_CSKY_V2__ */
+
+#undef INTERNAL_SYSCALL
+#define INTERNAL_SYSCALL(name, err, nr, args...)                \
+        INTERNAL_SYSCALL_RAW##nr(SYS_ify(name), err, args)
+
+#undef INTERNAL_SYSCALL_NCS
+#define INTERNAL_SYSCALL_NCS(number, err, nr, args...)          \
+  INTERNAL_SYSCALL_RAW##nr (number, err, args)
+
+#endif	/* __ASSEMBLER__ */
+
+/* Pointer mangling support.  */
+#if IS_IN (rtld)
+#else
+# ifdef __ASSEMBLER__
+#  ifdef __CSKYABIV2__
+#   define PTR_MANGLE(dst, src, guard)	\
+  mov	t0, a0;				\
+  READ_THREAD_POINTER()			\
+  ldw	guard, (a0, POINTER_GUARD); 	\
+  mov	a0, t0;				\
+  xor	dst, src, guard;
+#  else
+#   define PTR_MANGLE(dst, src, guard)	\
+  mov   r7, a0;				\
+  READ_THREAD_POINTER();		\
+  ldw   guard, (a0, POINTER_GUARD);	\
+  mov   a0, r7;\
+  xor   dst, src, guard;
+#  endif
+#  define PTR_DEMANGLE(dst, src, guard) PTR_MANGLE (dst, src, guard)
+#  define PTR_MANGLE2(dst, src, guard) \
+  xor	dst, src, guard
+#  define PTR_DEMANGLE2(dst, src, guard) PTR_MANGLE2 (dst, src, guard)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)     PTR_MANGLE (var)
+# endif
+#endif
+
+#endif /* linux/csky/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/csky/ucontext_i.sym b/sysdeps/unix/sysv/linux/csky/ucontext_i.sym
new file mode 100644
index 0000000..05fcf9d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/ucontext_i.sym
@@ -0,0 +1,31 @@
+#include <inttypes.h>
+#include <stddef.h>
+#include <sys/ucontext.h>
+
+SIG_BLOCK
+SIG_SETMASK
+
+-- Offsets of the fields in the ucontext_t structure.
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+UCONTEXT_FLAGS			ucontext(uc_flags)
+UCONTEXT_LINK			ucontext(uc_link)
+UCONTEXT_STACK			ucontext(uc_stack)
+UCONTEXT_MCONTEXT		ucontext(uc_mcontext)
+UCONTEXT_SIGMASK		ucontext(uc_sigmask)
+
+MCONTEXT_CSKY_A0		mcontext(sc_a0)
+MCONTEXT_CSKY_R4		mcontext(sc_regs[0])
+MCONTEXT_CSKY_R8		mcontext(sc_regs[2])
+MCONTEXT_CSKY_SP		mcontext(sc_usp)
+MCONTEXT_CSKY_LR		mcontext(sc_r15)
+#ifdef __CSKYABIV2__
+MCONTEXT_CSKY_R16		mcontext(sc_exregs[0])
+MCONTEXT_CSKY_HI		mcontext(sc_rhi)
+MCONTEXT_CSKY_LO		mcontext(sc_rlo)
+#endif
+MCONTEXT_CSKY_PC		mcontext(sc_pc)
+MCONTEXT_CSKY_FESR		mcontext(sc_fesr)
+MCONTEXT_CSKY_FSR		mcontext(sc_fsr)
+MCONTEXT_CSKY_FR0		mcontext(sc_fpregs[0])
-- 
2.7.4

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 08/10] C-SKY: Build Infastructure
  2018-04-08  7:03 ` [RFC PATCH V2 08/10] C-SKY: Build Infastructure Mao Han
@ 2018-04-08  7:41   ` Andreas Schwab
  2018-04-16  5:59     ` Mao Han
  2018-04-17 20:54   ` Joseph Myers
  1 sibling, 1 reply; 35+ messages in thread
From: Andreas Schwab @ 2018-04-08  7:41 UTC (permalink / raw)
  To: Mao Han; +Cc: libc-alpha, c-sky_gcc_upstream, gnu-csky

On Apr 08 2018, Mao Han <han_mao@c-sky.com> wrote:

> diff --git a/scripts/config.sub b/scripts/config.sub
> index f2632cd..9550e57 100755
> --- a/scripts/config.sub
> +++ b/scripts/config.sub
> @@ -254,7 +254,7 @@ case $basic_machine in
>  	| ba \
>  	| be32 | be64 \
>  	| bfin \
> -	| c4x | c8051 | clipper \
> +	| c4x | c8051 | clipper | csky \
>  	| d10v | d30v | dlx | dsp16xx \
>  	| e2k | epiphany \
>  	| fido | fr30 | frv | ft32 \
> @@ -378,7 +378,7 @@ case $basic_machine in
>  	| be32-* | be64-* \
>  	| bfin-* | bs2000-* \
>  	| c[123]* | c30-* | [cjt]90-* | c4x-* \
> -	| c8051-* | clipper-* | craynv-* | cydra-* \
> +	| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
>  	| d10v-* | d30v-* | dlx-* \
>  	| e2k-* | elxsi-* \
>  	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \

Please submit this to <config-patches@gnu.org>.  The latest version of
the file will then be imported here.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 00/10] port C-SKY to glibc
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (9 preceding siblings ...)
  2018-04-08  7:04 ` [RFC PATCH V2 10/10] C-SKY: Linux ABI Mao Han
@ 2018-04-08  7:51 ` Florian Weimer
  2018-04-08  8:29   ` Mao Han
  2018-04-17 20:44 ` Joseph Myers
  11 siblings, 1 reply; 35+ messages in thread
From: Florian Weimer @ 2018-04-08  7:51 UTC (permalink / raw)
  To: Mao Han; +Cc: libc-alpha, c-sky_gcc_upstream, gnu-csky

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 00/10] port C-SKY to glibc
  2018-04-08  7:51 ` [RFC PATCH V2 00/10] port C-SKY to glibc Florian Weimer
@ 2018-04-08  8:29   ` Mao Han
  2018-04-09  8:43     ` Florian Weimer
  0 siblings, 1 reply; 35+ messages in thread
From: Mao Han @ 2018-04-08  8:29 UTC (permalink / raw)
  To: Florian Weimer; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 00/10] port C-SKY to glibc
  2018-04-08  8:29   ` Mao Han
@ 2018-04-09  8:43     ` Florian Weimer
  2018-04-09  9:05       ` Mao Han
  0 siblings, 1 reply; 35+ messages in thread
From: Florian Weimer @ 2018-04-09  8:43 UTC (permalink / raw)
  To: Mao Han; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 00/10] port C-SKY to glibc
  2018-04-09  8:43     ` Florian Weimer
@ 2018-04-09  9:05       ` Mao Han
  0 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-09  9:05 UTC (permalink / raw)
  To: Florian Weimer; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 07/10] C-SKY: ABI Lists
  2018-04-08  7:03 ` [RFC PATCH V2 07/10] C-SKY: ABI Lists Mao Han
@ 2018-04-09 22:25   ` Rafal Luzynski
  2018-04-10  0:59     ` Mao Han
  0 siblings, 1 reply; 35+ messages in thread
From: Rafal Luzynski @ 2018-04-09 22:25 UTC (permalink / raw)
  To: libc-alpha, Mao Han; +Cc: c-sky_gcc_upstream, gnu-csky

8.04.2018 09:02 Mao Han <han_mao@c-sky.com> wrote:
> [...]
> diff --git a/sysdeps/unix/sysv/linux/csky/ld.abilist
> b/sysdeps/unix/sysv/linux/csky/ld.abilist
> new file mode 100644
> index 0000000..eb8a78c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/ld.abilist
> @@ -0,0 +1,10 @@
> +GLIBC_2.27 GLIBC_2.27 A
> +GLIBC_2.27 __libc_stack_end D 0x4

Shouldn't it be 2.28 everywhere?  2.27 has been released more than
2 months ago.  We are in the 2.28 development period already.

Regards,

Rafal

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 07/10] C-SKY: ABI Lists
  2018-04-09 22:25   ` Rafal Luzynski
@ 2018-04-10  0:59     ` Mao Han
  0 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-10  0:59 UTC (permalink / raw)
  To: Rafal Luzynski; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

hi,
On Tue, Apr 10, 2018 at 12:24:59AM +0200, Rafal Luzynski wrote:
> 8.04.2018 09:02 Mao Han <han_mao@c-sky.com> wrote:
> > [...]
> > diff --git a/sysdeps/unix/sysv/linux/csky/ld.abilist
> > b/sysdeps/unix/sysv/linux/csky/ld.abilist
> > new file mode 100644
> > index 0000000..eb8a78c
> > --- /dev/null
> > +++ b/sysdeps/unix/sysv/linux/csky/ld.abilist
> > @@ -0,0 +1,10 @@
> > +GLIBC_2.27 GLIBC_2.27 A
> > +GLIBC_2.27 __libc_stack_end D 0x4
> 
> Shouldn't it be 2.28 everywhere?  2.27 has been released more than
> 2 months ago.  We are in the 2.28 development period already.
Thanks for comment.
I'll update these version to 2.28.

Best Regards,
Mao Han

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface
  2018-04-08  7:03 ` [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface Mao Han
@ 2018-04-15 20:29   ` Arnd Bergmann
  2018-04-16  5:55     ` Mao Han
  2018-04-23 11:32   ` Adhemerval Zanella
  1 sibling, 1 reply; 35+ messages in thread
From: Arnd Bergmann @ 2018-04-15 20:29 UTC (permalink / raw)
  To: Mao Han; +Cc: GNU C Library, c-sky_gcc_upstream, gnu-csky

On Sun, Apr 8, 2018 at 9:02 AM, Mao Han <han_mao@c-sky.com> wrote:

> diff --git a/sysdeps/unix/sysv/linux/csky/syscalls.list b/sysdeps/unix/sysv/linux/csky/syscalls.list
> new file mode 100644
> index 0000000..53cff69
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/syscalls.list
> @@ -0,0 +1,7 @@
> +# File name    Caller  Syscall name    Args    Strong name     Weak names
> +
> +chown          -       chown32         i:sii   __chown         chown
> +cacheflush     -       cacheflush      i:pii   _flush_cache    cacheflush
> +
> +prlimit64      EXTRA   prlimit64       i:iipp  prlimit64
> +fanotify_mark  EXTRA   fanotify_mark   i:iiiiis        fanotify_mark

I can understand the need for the cacheflush syscall here, but why do you need
to override those other three? Shouldn't the defaults be correct for new
architectures?

       Arnd

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface
  2018-04-15 20:29   ` Arnd Bergmann
@ 2018-04-16  5:55     ` Mao Han
  0 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-16  5:55 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

On Sun, Apr 15, 2018 at 10:29:41PM +0200, Arnd Bergmann wrote:
> > diff --git a/sysdeps/unix/sysv/linux/csky/syscalls.list b/sysdeps/unix/sysv/linux/csky/syscalls.list
> > new file mode 100644
> > index 0000000..53cff69
> > --- /dev/null
> > +++ b/sysdeps/unix/sysv/linux/csky/syscalls.list
> > @@ -0,0 +1,7 @@
> > +# File name    Caller  Syscall name    Args    Strong name     Weak names
> > +
> > +chown          -       chown32         i:sii   __chown         chown
> > +cacheflush     -       cacheflush      i:pii   _flush_cache    cacheflush
> > +
> > +prlimit64      EXTRA   prlimit64       i:iipp  prlimit64
> > +fanotify_mark  EXTRA   fanotify_mark   i:iiiiis        fanotify_mark
> 
> I can understand the need for the cacheflush syscall here, but why do you need
> to override those other three? Shouldn't the defaults be correct for new
> architectures?
> 
>        Arnd
Thanks for the comment. The default implimentation of the other three are ok
for C-SKY. I'll remove them in syscalls.list.

Best Regards
Mao Han

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 08/10] C-SKY: Build Infastructure
  2018-04-08  7:41   ` Andreas Schwab
@ 2018-04-16  5:59     ` Mao Han
  0 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-16  5:59 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

On Sun, Apr 08, 2018 at 09:40:58AM +0200, Andreas Schwab wrote:
> > diff --git a/scripts/config.sub b/scripts/config.sub
> > index f2632cd..9550e57 100755
> > --- a/scripts/config.sub
> > +++ b/scripts/config.sub
> > @@ -254,7 +254,7 @@ case $basic_machine in
> >  	| ba \
> >  	| be32 | be64 \
> >  	| bfin \
> > -	| c4x | c8051 | clipper \
> > +	| c4x | c8051 | clipper | csky \
> >  	| d10v | d30v | dlx | dsp16xx \
> >  	| e2k | epiphany \
> >  	| fido | fr30 | frv | ft32 \
> > @@ -378,7 +378,7 @@ case $basic_machine in
> >  	| be32-* | be64-* \
> >  	| bfin-* | bs2000-* \
> >  	| c[123]* | c30-* | [cjt]90-* | c4x-* \
> > -	| c8051-* | clipper-* | craynv-* | cydra-* \
> > +	| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
> >  	| d10v-* | d30v-* | dlx-* \
> >  	| e2k-* | elxsi-* \
> >  	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
> 
> Please submit this to <config-patches@gnu.org>.  The latest version of
> the file will then be imported here.
> 
> Andreas.
Thanks for the suggestion. I've send the patch to config-patches@gnu.org, 
and will remove the modification in this patchset.
 
Best Regards
Mao Han

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 00/10] port C-SKY to glibc
  2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
                   ` (10 preceding siblings ...)
  2018-04-08  7:51 ` [RFC PATCH V2 00/10] port C-SKY to glibc Florian Weimer
@ 2018-04-17 20:44 ` Joseph Myers
       [not found]   ` <20180426072022.GA14714@vmh-VirtualBox>
  11 siblings, 1 reply; 35+ messages in thread
From: Joseph Myers @ 2018-04-17 20:44 UTC (permalink / raw)
  To: Mao Han; +Cc: libc-alpha, c-sky_gcc_upstream, gnu-csky

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 S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 02/10] C-SKY: TLS support
  2018-04-08  7:03 ` [RFC PATCH V2 02/10] C-SKY: TLS support Mao Han
@ 2018-04-17 20:50   ` Joseph Myers
  2018-04-26  7:33     ` Mao Han
  0 siblings, 1 reply; 35+ messages in thread
From: Joseph Myers @ 2018-04-17 20:50 UTC (permalink / raw)
  To: Mao Han; +Cc: libc-alpha, c-sky_gcc_upstream, gnu-csky

On Sun, 8 Apr 2018, Mao Han wrote:

> +/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
> + * present, but it is presumed absent.  */
> +#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)

This is not an appropriate default for a new port.  (Of course you need to 
fix your kernel port accordingly so it doesn't default to an executable 
stack either.)

Also, globally in the port, no leading '*' on second and subsequent lines 
of comments.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 01/10] C-SKY: ABI related code
  2018-04-08  7:03 ` [RFC PATCH V2 01/10] C-SKY: ABI related code Mao Han
@ 2018-04-17 20:53   ` Joseph Myers
  2018-04-26  7:27     ` Mao Han
  0 siblings, 1 reply; 35+ messages in thread
From: Joseph Myers @ 2018-04-17 20:53 UTC (permalink / raw)
  To: Mao Han; +Cc: libc-alpha, c-sky_gcc_upstream, gnu-csky

On Sun, 8 Apr 2018, Mao Han wrote:

>         * sysdeps/csky/backtrace.c: New file

Please explain why this file is needed rather than the generic 
debug/backtrace.c being sufficient.  (To the extent that some 
architectures do benefit from having their own variants on the generic 
version, we should try to work out how to refactor things to reduce 
duplication.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 08/10] C-SKY: Build Infastructure
  2018-04-08  7:03 ` [RFC PATCH V2 08/10] C-SKY: Build Infastructure Mao Han
  2018-04-08  7:41   ` Andreas Schwab
@ 2018-04-17 20:54   ` Joseph Myers
  1 sibling, 0 replies; 35+ messages in thread
From: Joseph Myers @ 2018-04-17 20:54 UTC (permalink / raw)
  To: Mao Han; +Cc: libc-alpha, c-sky_gcc_upstream, gnu-csky

On Sun, 8 Apr 2018, Mao Han wrote:

> diff --git a/sysdeps/csky/configure.ac b/sysdeps/csky/configure.ac
> new file mode 100644
> index 0000000..34f62d4
> --- /dev/null
> +++ b/sysdeps/csky/configure.ac
> @@ -0,0 +1,4 @@
> +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> +# Local configure fragment for sysdeps/riscv/elf.

This certainly isn't riscv (and there haven't been elf/ sysdeps 
directories for many years).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 10/10] C-SKY: Linux ABI
  2018-04-08  7:04 ` [RFC PATCH V2 10/10] C-SKY: Linux ABI Mao Han
@ 2018-04-17 20:56   ` Joseph Myers
  0 siblings, 0 replies; 35+ messages in thread
From: Joseph Myers @ 2018-04-17 20:56 UTC (permalink / raw)
  To: Mao Han; +Cc: libc-alpha, c-sky_gcc_upstream, gnu-csky

On Sun, 8 Apr 2018, Mao Han wrote:

> diff --git a/sysdeps/unix/sysv/linux/csky/Versions b/sysdeps/unix/sysv/linux/csky/Versions
> new file mode 100644
> index 0000000..bcb77fd
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/Versions
> @@ -0,0 +1,34 @@
> +libc {
> +  GLIBC_2.27 {

None of this should be needed, beyond maybe the cacheflush entry; the 
generic Versions entries should suffice.

> +    # Exception handling support functions from libgcc
> +    __register_frame; __register_frame_table; __deregister_frame;
> +    __frame_state_for; __register_frame_info_table;

These should only be in extremely old glibc ports, not anything from the 
past decade.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface
  2018-04-08  7:03 ` [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface Mao Han
  2018-04-15 20:29   ` Arnd Bergmann
@ 2018-04-23 11:32   ` Adhemerval Zanella
  2018-04-26  7:39     ` Mao Han
  1 sibling, 1 reply; 35+ messages in thread
From: Adhemerval Zanella @ 2018-04-23 11:32 UTC (permalink / raw)
  To: libc-alpha



On 08/04/2018 04:02, Mao Han wrote:
> diff --git a/sysdeps/unix/sysv/linux/csky/ftruncate64.c b/sysdeps/unix/sysv/linux/csky/ftruncate64.c
> new file mode 100644
> index 0000000..47c38e6
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/ftruncate64.c
> @@ -0,0 +1,41 @@

> +/* Truncate the file FD refers to to LENGTH bytes.  */
> +int
> +__ftruncate64 (int fd, off64_t length)
> +{
> +  unsigned int low = length & 0xffffffff;
> +  unsigned int high = length >> 32;
> +#ifdef __CSKYABIV2__
> +  int result = INLINE_SYSCALL (ftruncate64, 3, fd,
> +			       __LONG_LONG_PAIR (high, low));
> +#else
> +  int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
> +			       __LONG_LONG_PAIR (high, low));
> +#endif
> +  return result;
> +}
> +weak_alias (__ftruncate64, ftruncate64)

If I understand correctly the ABIv1 requires oven register for 64 bit argument
passing, which is represented inside glibc as __ASSUME_ALIGNED_REGISTER_PAIRS
set to 1.  So setting it correctly for ABIv1 should make it possible to use
the generic 'sysdeps/unix/sysv/linux/ftruncate64.c' for c-sky.

> diff --git a/sysdeps/unix/sysv/linux/csky/readahead.c b/sysdeps/unix/sysv/linux/csky/readahead.c
> new file mode 100644
> index 0000000..255361c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/readahead.c
> @@ -0,0 +1,34 @@

> +
> +ssize_t
> +__readahead (int fd, off64_t offset, size_t count)
> +{
> +  return INLINE_SYSCALL_CALL (readahead, fd,
> +                              __ALIGNMENT_ARG SYSCALL_LL64 (offset), count);
> +}
> +
> +weak_alias (__readahead, readahead)

I just sent a patch to consolidate Linux readahead implementation [1]. So most
likely this new arch-specific file for c-sky would be unnecessary. 


> diff --git a/sysdeps/unix/sysv/linux/csky/scandir64.c b/sysdeps/unix/sysv/linux/csky/scandir64.c
> new file mode 100644
> index 0000000..506fd88
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/csky/scandir64.c
> @@ -0,0 +1 @@
> +#include <sysdeps/unix/sysv/linux/i386/scandir64.c>

The 'scandir{at}{64}' consolidation is pushed upstream [2], so this file should
be unnecessary as well.

[1] https://sourceware.org/ml/libc-alpha/2018-04/msg00471.html
[2] https://sourceware.org/git/?p=glibc.git;a=commit;h=c0123b3b1118419210879e935620eb2ad987c2f1

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 01/10] C-SKY: ABI related code
  2018-04-17 20:53   ` Joseph Myers
@ 2018-04-26  7:27     ` Mao Han
  0 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-26  7:27 UTC (permalink / raw)
  To: Joseph Myers; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

Hi,
On Tue, Apr 17, 2018 at 08:52:50PM +0000, Joseph Myers wrote:
> On Sun, 8 Apr 2018, Mao Han wrote:
> 
> >         * sysdeps/csky/backtrace.c: New file
> 
> Please explain why this file is needed rather than the generic 
> debug/backtrace.c being sufficient.  (To the extent that some 
> architectures do benefit from having their own variants on the generic 
> version, we should try to work out how to refactor things to reduce 
> duplication.)
>
Seems no need to add the new file. I'll using the generic version.

Best Regards,
Mao Han

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 02/10] C-SKY: TLS support
  2018-04-17 20:50   ` Joseph Myers
@ 2018-04-26  7:33     ` Mao Han
  2018-04-26 16:00       ` Joseph Myers
  0 siblings, 1 reply; 35+ messages in thread
From: Mao Han @ 2018-04-26  7:33 UTC (permalink / raw)
  To: Joseph Myers; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

Hi,
On Tue, Apr 17, 2018 at 08:50:03PM +0000, Joseph Myers wrote:
> On Sun, 8 Apr 2018, Mao Han wrote:
> 
> > +/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
> > + * present, but it is presumed absent.  */
> > +#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
> 
> This is not an appropriate default for a new port.  (Of course you need to 
> fix your kernel port accordingly so it doesn't default to an executable 
> stack either.)
> 
> Also, globally in the port, no leading '*' on second and subsequent lines 
> of comments.
>
So just define to #define DEFAULT_STACK_PERMS (PF_R|PF_W). We have no 
memory executable on our hardware. So seems not need to change on the
kernel side?

Best Regards,
Mao Han

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface
  2018-04-23 11:32   ` Adhemerval Zanella
@ 2018-04-26  7:39     ` Mao Han
  0 siblings, 0 replies; 35+ messages in thread
From: Mao Han @ 2018-04-26  7:39 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

Hi,
Thanks for the comment.
On Mon, Apr 23, 2018 at 08:32:16AM -0300, Adhemerval Zanella wrote:
> > +#ifdef __CSKYABIV2__
> > +  int result = INLINE_SYSCALL (ftruncate64, 3, fd,
> > +			       __LONG_LONG_PAIR (high, low));
> > +#else
> > +  int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
> > +			       __LONG_LONG_PAIR (high, low));
> > +#endif
> > +  return result;
> > +}
> > +weak_alias (__ftruncate64, ftruncate64)
> 
> If I understand correctly the ABIv1 requires oven register for 64 bit argument
> passing, which is represented inside glibc as __ASSUME_ALIGNED_REGISTER_PAIRS
> set to 1.  So setting it correctly for ABIv1 should make it possible to use
> the generic 'sysdeps/unix/sysv/linux/ftruncate64.c' for c-sky.
>
OK, I'll try the macro and the generic implementation.
 
> > +
> > +ssize_t
> > +__readahead (int fd, off64_t offset, size_t count)
> > +{
> > +  return INLINE_SYSCALL_CALL (readahead, fd,
> > +                              __ALIGNMENT_ARG SYSCALL_LL64 (offset), count);
> > +}
> > +
> > +weak_alias (__readahead, readahead)
> 
> I just sent a patch to consolidate Linux readahead implementation [1]. So most
> likely this new arch-specific file for c-sky would be unnecessary. 
> 
> 
> > +++ b/sysdeps/unix/sysv/linux/csky/scandir64.c
> > @@ -0,0 +1 @@
> > +#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
> 
> The 'scandir{at}{64}' consolidation is pushed upstream [2], so this file should
> be unnecessary as well.
> 
> [1] https://sourceware.org/ml/libc-alpha/2018-04/msg00471.html
> [2] https://sourceware.org/git/?p=glibc.git;a=commit;h=c0123b3b1118419210879e935620eb2ad987c2f1
OK, I'll change to the consolidated implementation.

Best Regards,
Mao Han

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 00/10] port C-SKY to glibc
       [not found]   ` <20180426072022.GA14714@vmh-VirtualBox>
@ 2018-04-26 11:45     ` Joseph Myers
  0 siblings, 0 replies; 35+ messages in thread
From: Joseph Myers @ 2018-04-26 11:45 UTC (permalink / raw)
  To: Mao Han; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

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

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 02/10] C-SKY: TLS support
  2018-04-26  7:33     ` Mao Han
@ 2018-04-26 16:00       ` Joseph Myers
  2018-04-27  1:55         ` Guo Ren
  0 siblings, 1 reply; 35+ messages in thread
From: Joseph Myers @ 2018-04-26 16:00 UTC (permalink / raw)
  To: Mao Han; +Cc: c-sky_gcc_upstream, gnu-csky, libc-alpha

On Thu, 26 Apr 2018, Mao Han wrote:

> Hi,
> On Tue, Apr 17, 2018 at 08:50:03PM +0000, Joseph Myers wrote:
> > On Sun, 8 Apr 2018, Mao Han wrote:
> > 
> > > +/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
> > > + * present, but it is presumed absent.  */
> > > +#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
> > 
> > This is not an appropriate default for a new port.  (Of course you need to 
> > fix your kernel port accordingly so it doesn't default to an executable 
> > stack either.)
> > 
> > Also, globally in the port, no leading '*' on second and subsequent lines 
> > of comments.
> >
> So just define to #define DEFAULT_STACK_PERMS (PF_R|PF_W). We have no 
> memory executable on our hardware. So seems not need to change on the
> kernel side?

I believe the relevant kernel definitions to check, to make sure that the 
kernel does not give execute permissions to stack pages by default, are 
elf_read_implies_exec and VM_STACK_DEFAULT_FLAGS / VM_DATA_DEFAULT_FLAGS.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 02/10] C-SKY: TLS support
  2018-04-26 16:00       ` Joseph Myers
@ 2018-04-27  1:55         ` Guo Ren
  2018-04-27 12:10           ` Joseph Myers
  0 siblings, 1 reply; 35+ messages in thread
From: Guo Ren @ 2018-04-27  1:55 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky, libc-alpha

Thx Joseph,

On Thu, Apr 26, 2018 at 04:00:17PM +0000, Joseph Myers wrote:
> I believe the relevant kernel definitions to check, to make sure that the 
> kernel does not give execute permissions to stack pages by default, are 
> elf_read_implies_exec and VM_STACK_DEFAULT_FLAGS / VM_DATA_DEFAULT_FLAGS.
For c-sky kernel:
 - elf_read_implies_exec is return 0 which defined in include/linux/elf.h
 - VM_STACK_DEFAUT_FLAGS is the same with VM_DATA_DEFAULT_FAGS defined
   in include/linux/mm.h.
 - VM_DATA_DEFAULT_FLAGS is defined in csky/include/asm/page.h:
     #define VM_DATA_DEFAULT_FLAGS \
               (VM_READ    | VM_WRITE    | VM_EXEC | \
                VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)

And our hardware mmu tlb-entry do not have EXEC bit to protect the
page-non-exec.
So we put VM_EXEC as default in VM_DATA_DEFAULT_FLAGS.

Use generic elf_read_implies_exec seems wrong and we should "return 1",
isn't it?

Best Regards
 Guo Ren

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 02/10] C-SKY: TLS support
  2018-04-27  1:55         ` Guo Ren
@ 2018-04-27 12:10           ` Joseph Myers
  2018-04-29  8:49             ` Guo Ren
  0 siblings, 1 reply; 35+ messages in thread
From: Joseph Myers @ 2018-04-27 12:10 UTC (permalink / raw)
  To: Guo Ren; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky, libc-alpha

On Fri, 27 Apr 2018, Guo Ren wrote:

> And our hardware mmu tlb-entry do not have EXEC bit to protect the
> page-non-exec.

I'm not sure what's best in the kernel for hardware not supporting 
readable but non-executable pages.

However, whatever the solution, I'd say the following principle applies to 
userspace code: binaries that require execution of code on stack pages 
should be distinguished from those that do not, and the latter should be 
the default, so that if a future hardware version does support readable 
but non-executable pages, existing binaries can automatically get 
non-executable stacks when run on the new hardware.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [RFC PATCH V2 02/10] C-SKY: TLS support
  2018-04-27 12:10           ` Joseph Myers
@ 2018-04-29  8:49             ` Guo Ren
  0 siblings, 0 replies; 35+ messages in thread
From: Guo Ren @ 2018-04-29  8:49 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Mao Han, c-sky_gcc_upstream, gnu-csky, libc-alpha

On Fri, Apr 27, 2018 at 12:10:19PM +0000, Joseph Myers wrote:
> However, whatever the solution, I'd say the following principle applies to 
> userspace code: binaries that require execution of code on stack pages 
> should be distinguished from those that do not, and the latter should be 
> the default, so that if a future hardware version does support readable 
> but non-executable pages, existing binaries can automatically get 
> non-executable stacks when run on the new hardware.
Ok, got it.

Thx
 Guo Ren

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2018-04-29  8:49 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-08  7:03 [RFC PATCH V2 00/10] port C-SKY to glibc Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 07/10] C-SKY: ABI Lists Mao Han
2018-04-09 22:25   ` Rafal Luzynski
2018-04-10  0:59     ` Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 03/10] C-SKY: Generic math Routines Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 09/10] C-SKY: Linux Startup and Dynamic Loading Code Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 05/10] C-SKY: Atomic and Locking Routines Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 08/10] C-SKY: Build Infastructure Mao Han
2018-04-08  7:41   ` Andreas Schwab
2018-04-16  5:59     ` Mao Han
2018-04-17 20:54   ` Joseph Myers
2018-04-08  7:03 ` [RFC PATCH V2 01/10] C-SKY: ABI related code Mao Han
2018-04-17 20:53   ` Joseph Myers
2018-04-26  7:27     ` Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 06/10] C-SKY: Linux Syscall Interface Mao Han
2018-04-15 20:29   ` Arnd Bergmann
2018-04-16  5:55     ` Mao Han
2018-04-23 11:32   ` Adhemerval Zanella
2018-04-26  7:39     ` Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 04/10] C-SKY: Hard Float Support Mao Han
2018-04-08  7:03 ` [RFC PATCH V2 02/10] C-SKY: TLS support Mao Han
2018-04-17 20:50   ` Joseph Myers
2018-04-26  7:33     ` Mao Han
2018-04-26 16:00       ` Joseph Myers
2018-04-27  1:55         ` Guo Ren
2018-04-27 12:10           ` Joseph Myers
2018-04-29  8:49             ` Guo Ren
2018-04-08  7:04 ` [RFC PATCH V2 10/10] C-SKY: Linux ABI Mao Han
2018-04-17 20:56   ` Joseph Myers
2018-04-08  7:51 ` [RFC PATCH V2 00/10] port C-SKY to glibc Florian Weimer
2018-04-08  8:29   ` Mao Han
2018-04-09  8:43     ` Florian Weimer
2018-04-09  9:05       ` Mao Han
2018-04-17 20:44 ` Joseph Myers
     [not found]   ` <20180426072022.GA14714@vmh-VirtualBox>
2018-04-26 11:45     ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).