diff --git a/sysdeps/nds32/__longjmp.S b/sysdeps/nds32/__longjmp.S
new file mode 100644
index 0000000..7ff3550
--- /dev/null
+++ b/sysdeps/nds32/__longjmp.S
@@ -0,0 +1,35 @@
+/* longjmp, Andes nds32 version.
+   Copyright (C) 1996-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 _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+	.section .text
+
+ENTRY(__longjmp)
+	/* Restore registers.  */
+	lmw.bim  $r6, [$r0], $r14, #0xf
+
+	/* Return error code. Make sure error code is not 0.  */
+	bnez  $r1, .Ldone
+	movi  $r1, #1
+.Ldone:
+	addi  $r0, $r1, #0
+	ret
+END(__longjmp)
diff --git a/sysdeps/nds32/bits/endian.h b/sysdeps/nds32/bits/endian.h
new file mode 100644
index 0000000..363a95a
--- /dev/null
+++ b/sysdeps/nds32/bits/endian.h
@@ -0,0 +1,29 @@
+/* Define __BYTE_ORDER. Andes nds32 version
+   Copyright (C) 1997-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 _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+
+
+#if defined __NDS32_EB__
+# error "Big-endian is un-supported."
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/sysdeps/nds32/bits/link.h b/sysdeps/nds32/bits/link.h
new file mode 100644
index 0000000..7b3f078
--- /dev/null
+++ b/sysdeps/nds32/bits/link.h
@@ -0,0 +1,54 @@
+/* Machine-specific declarations for dynamic linker interface.  Andes nds32 version.
+   Copyright (C) 2005-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 NDS32.  */
+typedef struct La_nds32_regs
+{
+  uint32_t lr_reg[6];
+  uint32_t lr_gp;
+  uint32_t lr_lp;
+  uint32_t lr_sp;
+} La_nds32_regs;
+
+/* Return values for calls from PLT on NDS32.  */
+typedef struct La_nds32_retval
+{
+  uint32_t lrv_reg[2];
+} La_nds32_retval;
+
+__BEGIN_DECLS
+
+extern ElfW(Addr) la_nds32_gnu_pltenter (ElfW(Sym) *__sym, unsigned int __ndx,
+					 uintptr_t *__refcook,
+					 uintptr_t *__defcook,
+					 La_nds32_regs *__regs,
+					 unsigned int *__flags,
+					 const char *__symname,
+					 long int *__framesizep);
+extern unsigned int la_nds32_gnu_pltexit (ElfW(Sym) *__sym, unsigned int __ndx,
+					  uintptr_t *__refcook,
+					  uintptr_t *__defcook,
+					  const La_nds32_regs *__inregs,
+					  La_nds32_retval *__outregs,
+					  const char *__symname);
+
+__END_DECLS
diff --git a/sysdeps/nds32/bits/setjmp.h b/sysdeps/nds32/bits/setjmp.h
new file mode 100644
index 0000000..e2f92d2
--- /dev/null
+++ b/sysdeps/nds32/bits/setjmp.h
@@ -0,0 +1,54 @@
+/* Define the machine-dependent type `jmp_buf'.  Andes nds32 version.
+   Copyright (C) 2003-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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H  1
+
+#if !defined _SETJMP_H && !defined _PTHREAD_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#ifndef _ASM
+
+/*
+  For nds32, there are 32 general purpose registers.
+  1. Caller saved register for parameter passing: $r0 - $r5
+  2. Callee saved register: $r6 - $r14
+  3. Assembler reserved register: $r15
+  4. Caller saved register: $r6 - $r24
+  5. Thread pointer register: $r25
+  6. Reserved register for kernel space: $r26 - $27
+  7. Frame pointer: $r28
+  8. Global pointer: $r29
+  9. Link register: $r30
+  10.Stack pointer: $r31
+
+  Only callee saved register and $r28-$r31 needs to store in jmp_buf.
+  Reserved(For 8-byte align if needed)
+*/
+
+typedef struct __jmp_buf_internal_tag
+  {
+    /* Callee-saved registers: $r6 - $r14, $fp, $gp, $lp, $sp: $r28 - $r31.  */
+    int __regs[13];
+  } __jmp_buf[1] __attribute__ ((__aligned__ (8)));
+
+#endif
+
+#endif  /* bits/setjmp.h */
diff --git a/sysdeps/nds32/bsd-_setjmp.S b/sysdeps/nds32/bsd-_setjmp.S
new file mode 100644
index 0000000..90b99cd
--- /dev/null
+++ b/sysdeps/nds32/bsd-_setjmp.S
@@ -0,0 +1 @@
+/* _setjmp is in setjmp.S.  */
diff --git a/sysdeps/nds32/bsd-setjmp.S b/sysdeps/nds32/bsd-setjmp.S
new file mode 100644
index 0000000..d3b823c
--- /dev/null
+++ b/sysdeps/nds32/bsd-setjmp.S
@@ -0,0 +1 @@
+/* setjmp is in setjmp.S.  */
diff --git a/sysdeps/nds32/gccframe.h b/sysdeps/nds32/gccframe.h
new file mode 100644
index 0000000..2ef5bc2
--- /dev/null
+++ b/sysdeps/nds32/gccframe.h
@@ -0,0 +1,21 @@
+/* Definition of object in frame unwind info.  Andes nds32 version.
+   Copyright (C) 2001-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 34
+
+#include <sysdeps/generic/gccframe.h>
diff --git a/sysdeps/nds32/jmpbuf-offsets.h b/sysdeps/nds32/jmpbuf-offsets.h
new file mode 100644
index 0000000..7026c90
--- /dev/null
+++ b/sysdeps/nds32/jmpbuf-offsets.h
@@ -0,0 +1,34 @@
+/* Private macros for accessing __jmp_buf contents. Andes nds32 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 JB_R6   0
+#define JB_R7   1
+#define JB_R8   2
+#define JB_R9   3
+#define JB_R10  4
+#define JB_R11  5
+#define JB_R12  6
+#define JB_R13  7
+#define JB_R14  8
+#define JB_FP   9
+#define JB_GP   10
+#define JB_LP   11
+#define JB_SP   12
+
+#define JB_FRAME_ADDRESS(buf) \
+	 ((void *)buf[0].__regs[JB_SP])
diff --git a/sysdeps/nds32/jmpbuf-unwind.h b/sysdeps/nds32/jmpbuf-unwind.h
new file mode 100644
index 0000000..373f114
--- /dev/null
+++ b/sysdeps/nds32/jmpbuf-unwind.h
@@ -0,0 +1,47 @@
+/* Examine __jmp_buf for unwinding frames.  Andes nds32 version.
+   Copyright (C) 2003-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 <jmpbuf-offsets.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) < &(jmpbuf)[0].__regs[JB_SP])
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = (uintptr_t) &(regs)[0].__regs[JB_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/nds32/linkmap.h b/sysdeps/nds32/linkmap.h
new file mode 100644
index 0000000..89e912a
--- /dev/null
+++ b/sysdeps/nds32/linkmap.h
@@ -0,0 +1,26 @@
+/* Define nds32 link_map_machine
+   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/>.  */
+
+struct link_map_machine
+  {
+    ElfW(Addr) plt; /* Address of .plt.  */
+    ElfW(Addr) gotplt; /* Address of .got.  */
+    void *tlsdesc_table;
+  };
+
diff --git a/sysdeps/nds32/machine-gmon.h b/sysdeps/nds32/machine-gmon.h
new file mode 100644
index 0000000..97b4b7c
--- /dev/null
+++ b/sysdeps/nds32/machine-gmon.h
@@ -0,0 +1,34 @@
+/* profiling support for Andes nds32 version
+   Copyright (C) 1996-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>
+
+static void __attribute_used__ __mcount_internal (unsigned long int frompc,
+						  unsigned long int selfpc);
+
+#define _MCOUNT_DECL(frompc, selfpc) \
+static void __mcount_internal (unsigned long int frompc, \
+unsigned long int selfpc)
+
+
+#define MCOUNT								\
+void _mcount (unsigned long int frompc)		      			\
+{									\
+  __mcount_internal (frompc, (unsigned long int) RETURN_ADDRESS (0));	\
+}
+
diff --git a/sysdeps/nds32/memcpy.S b/sysdeps/nds32/memcpy.S
new file mode 100644
index 0000000..d1cc090
--- /dev/null
+++ b/sysdeps/nds32/memcpy.S
@@ -0,0 +1,102 @@
+/* Memory copy, Andes nds32 version
+   Copyright (C) 2009-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>
+
+/* void *memcpy(void *dst, const void *src, int n);
+
+   dst: $r0
+   src: $r1
+   n  : $r2
+   ret: $r0 - pointer to the memory area dst.  */
+
+ENTRY (memcpy)
+	/* Set $r3 as the dest. Keep value of $r0.  */
+	move    $r3, $r0
+	/* if len<4, go to byte-mode.  */
+	slti	$ta, $r2, 4
+	bnez	$ta, .Lbyte_mode
+	andi	$r4, $r3, 0x3
+	andi	$r5, $r1, 0x3
+
+	/* handle unligned leading bytes.  */
+	beqz	$r5, .LWord_aligned
+	subri	$r5, $r5, #4
+	sub	$r2, $r2, $r5
+	add	$r5, $r5, $r1
+
+.align	2
+1:
+	/* byte-mode copy loop.  */
+	lbi.bi	$r4, [$r1], 1
+	sbi.bi	$r4, [$r3], 1
+	bne	$r1, $r5, 1b
+
+.align  2
+.LWord_aligned:
+	/* assume cache-line size is 32 bytes.  */
+	srli	$r5, $r2, 5
+	beqz	$r5, .Lword_mode
+	slli	$r5, $r5, 5
+	add	$r5, $r5, $r1
+	andi	$r2, $r2, 0x1f
+
+	/* cache-line-mode copy loop.  */
+.align	2
+5:
+	lmw.bim	$r16, [$r1], $r23, #0
+	smw.bim	$r16, [$r3], $r23, #0
+	/* Next cache-line.  */
+	bne	$r1, $r5, 5b
+
+.align  2
+.Lword_mode:
+	srli	$r5, $r2, 2
+	beqz	$r5, .Lbyte_mode
+	slli	$r5, $r5, 2
+	add	$r5, $r5, $r1
+	andi	$r2, $r2, 0x3
+
+	/* word-mode copy loop.  */
+.align	2
+3:
+	lmw.bim	$r4, [$r1], $r4, #0
+	smw.bim	$r4, [$r3], $r4, #0
+	/* Next word.  */
+	bne	$r1, $r5, 3b
+
+.align  2
+.Lbyte_mode:
+	beqz	$r2, .Lend
+	add	$r5, $r1, $r2
+
+.align	2
+4:
+	/* byte-mode copy loop.  */
+	lbi.bi	$r4, [$r1], #1
+	sbi.bi	$r4, [$r3], #1
+	bne	$r1, $r5, 4b
+
+.align  2
+.Lend:
+	ret
+
+END (memcpy)
+libc_hidden_builtin_def (memcpy)
+
diff --git a/sysdeps/nds32/memset.S b/sysdeps/nds32/memset.S
new file mode 100644
index 0000000..05f81e0
--- /dev/null
+++ b/sysdeps/nds32/memset.S
@@ -0,0 +1,120 @@
+/* Optimized version for Andes nds32.
+   Copyright (C) 2006-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>
+
+/* void *memset(void *dst, int val, int len);
+ 
+         dst: $r0
+         val: $r1
+         len: $r2
+         ret: $r0 - pointer to the memory area dst.  */
+
+ENTRY(memset)
+	/* Set $r3 as the dest. Keep value of $r0.  */
+	move	$r3, $r0
+	/* if len<4, go to byte-mode.  */
+	slti	$ta, $r2, 4
+	bnez	$ta, .Lbyte_mode
+	andi	$r5, $r3, 0x3
+	beqz	$r5, .Lword_prepare
+	/* size to next word-aligned addres.  */
+	subri	$r5, $r5, #4
+	/* $r2: bytes left.  */
+	sub	$r2, $r2, $r5
+	add	$r5, $r5, $r0
+
+.align	2
+1:
+	/* byte-mode set loop.  */
+	sbi.bi	$r1, [$r3], 1
+	bne	$r3, $r5, 1b
+
+.align  2
+.Lword_prepare:
+	/* prepare word.  */
+
+	/* $r1  <- 0x000000ab.  */
+	andi    $r1, $r1, 0xff
+	/* $r4  <- 0x0000ab00.  */
+	slli    $r4, $r1, 8
+	/* $r1  <- 0x0000abab.  */
+	or      $r1, $r1, $r4
+	/* $r4  <- 0xabab0000.  */
+	slli    $r4, $r1, 16
+	/* $r1  <- 0xabababab.  */
+	or      $r1, $r1, $r4
+
+	/* assume cache-line size is 32 bytes.  */
+	srli	$r5, $r2, 5
+	beqz	$r5, .Lword_mode
+	slli	$r5, $r5, 5
+	add	$r5, $r5, $r3
+	andi	$r2, $r2, 0x1f
+
+	/* cache-line-mode set loop.  */
+	move $r16,$r1
+	move $r17,$r1
+	move $r18,$r1
+	move $r19,$r1
+	move $r20,$r1
+	move $r21,$r1
+	move $r22,$r1
+	move $r23,$r1
+
+.align	2
+4:
+	/* $r3 is dst.  */
+	smw.bim	$r16, [$r3], $r23, #0
+	/* Next cache-line.  */
+	bne	$r3, $r5, 4b
+
+.align  2
+.Lword_mode:
+	/* $r5 <- n words to set.  */
+	srli	$r5, $r2, 2
+	beqz	$r5, .Lbyte_mode
+	slli	$r5, $r5, 2
+	add	$r5, $r5, $r3
+	andi	$r2, $r2, 0x3
+
+	/* word-mode set loop.  */
+.align	2
+2:
+	smw.bim	$r1, [$r3], $r1, #0
+	/* Next word.  */
+	bne $r3, $r5, 2b
+
+.align  2
+.Lbyte_mode:
+	beqz	$r2, .Lend
+	add	$r5, $r3, $r2
+
+.align	2
+3:
+	/* byte-mode set loops.  */
+	sbi.bi	$r1, [$r3], #1
+	bne	$r3, $r5, 3b
+.align  2
+.Lend:
+	ret
+
+END(memset)
+libc_hidden_builtin_def (memset)
+
diff --git a/sysdeps/nds32/memusage.h b/sysdeps/nds32/memusage.h
new file mode 100644
index 0000000..e227c90
--- /dev/null
+++ b/sysdeps/nds32/memusage.h
@@ -0,0 +1,21 @@
+/* Machine-specific definitions for memory usage profiling, Andes nds32 version.
+   Copyright (C) 2000-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/nds32/nptl/pthreaddef.h b/sysdeps/nds32/nptl/pthreaddef.h
new file mode 100644
index 0000000..6ba4596
--- /dev/null
+++ b/sysdeps/nds32/nptl/pthreaddef.h
@@ -0,0 +1,33 @@
+/* pthread machine parameter definitions,  Andes nds32 version.
+   Copyright (C) 2011-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		16
+
+/* Minimal stack size after allocating thread descriptor and guard size.  */
+#define MINIMAL_REST_STACK	2048
+
+/* Alignment requirement for TCB.  */
+#define TCB_ALIGNMENT		16
+
+
+/* Location of current stack frame.  */
+#define CURRENT_STACK_FRAME	__builtin_frame_address (0)
diff --git a/sysdeps/nds32/setjmp.S b/sysdeps/nds32/setjmp.S
new file mode 100644
index 0000000..dc9c658
--- /dev/null
+++ b/sysdeps/nds32/setjmp.S
@@ -0,0 +1,66 @@
+/* setjmp for Andes nds32.
+   Copyright (C) 1996-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 _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+	.section .text
+#ifdef PIC
+# define JMP_BY_R2(symbol)						\
+	sethi   $r3, hi20(symbol@PLT);					\
+	ori     $r3, $r3, lo12(symbol@PLT);				\
+	add     $r3, $r3, $r2;						\
+	jr      $r3
+# define TCALL_SIGJMP_SAVE						\
+	GET_GTABLE ($r2);						\
+	JMP_BY_R2 (__sigjmp_save)
+#else
+# define JMP_BY_R2(symbol)						\
+	la	$r15, C_SYMBOL_NAME(symbol);				\
+	jr	$r15
+# define TCALL_SIGJMP_SAVE						\
+	JMP_BY_R2 (__sigjmp_save)
+#endif
+
+ENTRY(_setjmp)
+	move	$r1, #0
+	/* Initialize $r2 as $gp value.  */
+	GET_GTABLE ($r2)
+        /* Make a tail call to __sigsetjmp.  */
+	JMP_BY_R2 (HIDDEN_JUMPTARGET (__sigsetjmp))
+END(_setjmp)
+ENTRY(setjmp)
+	move	$r1, #1
+	/* Initialize $r2 as $gp value.  */
+	GET_GTABLE ($r2)
+        /* Make a tail call to __sigsetjmp.  */
+	JMP_BY_R2 (HIDDEN_JUMPTARGET (__sigsetjmp))
+END(setjmp)
+
+ENTRY(__sigsetjmp)
+	move	$r2, $r0
+	/* Save callee-saved registers into buffer.  */
+	smw.bim	$r6, [$r2], $r14, #0xf
+        /* Make a tail call to __sigjmp_save.  */
+	TCALL_SIGJMP_SAVE
+
+END(__sigsetjmp)
+hidden_def(__sigsetjmp)
+weak_alias (_setjmp, __GI__setjmp)
diff --git a/sysdeps/nds32/sotruss-lib.c b/sysdeps/nds32/sotruss-lib.c
new file mode 100644
index 0000000..d77b7fa
--- /dev/null
+++ b/sysdeps/nds32/sotruss-lib.c
@@ -0,0 +1,50 @@
+/* Override generic sotruss-lib.c to define actual functions for Andes nds32.
+   Copyright (C) 2013-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_nds32_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
+		       unsigned int ndx __attribute__ ((unused)),
+		       uintptr_t *refcook, uintptr_t *defcook,
+		       La_nds32_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_nds32_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
+		      uintptr_t *defcook, const struct La_nds32_regs *inregs,
+		      struct La_nds32_retval *outregs, const char *symname)
+{
+  print_exit (refcook, defcook, symname, outregs->lrv_reg[0]);
+
+  return 0;
+}
diff --git a/sysdeps/nds32/stackinfo.h b/sysdeps/nds32/stackinfo.h
new file mode 100644
index 0000000..115b562
--- /dev/null
+++ b/sysdeps/nds32/stackinfo.h
@@ -0,0 +1,32 @@
+/* Stack environment definitions for Andes nds32.
+   Copyright (C) 2011-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 file contains a bit of information about the stack allocation
+   of the processor.  */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H 1
+
+#include <elf.h>
+
+#define _STACK_GROWS_DOWN 1
+
+/* Default to a non-executable stack.  */
+#define DEFAULT_STACK_PERMS (PF_R|PF_W)
+
+#endif /* stackinfo.h */
diff --git a/sysdeps/nds32/strcmp.S b/sysdeps/nds32/strcmp.S
new file mode 100644
index 0000000..420d0ff
--- /dev/null
+++ b/sysdeps/nds32/strcmp.S
@@ -0,0 +1,105 @@
+/* Optimized version for Andes nds32.
+   Copyright (C) 2015-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/>.  */
+
+/*
+    Function:
+       strcmp - compare two strings.
+    Syntax:
+       int strcmp(const char *s1, const char *s2);
+    Description:
+       The strcmp function compares the string pointed to by s1 to the string
+       pointed to by s2.
+    Return value:
+       Return n integer greater than, equal to, or less than zero, accordingly
+       as the string pointed to by s1 is greater than, equal to, or less than
+       the string pointed to by s2.
+*/
+#include <sysdep.h>
+        .text
+
+ENTRY(strcmp)
+#if defined (__NDS32_EXT_STRING__)
+1:
+	lmwzb.bm	$r2, [$r0], $r2, #0
+	lmwzb.bm	$r3, [$r1], $r3, #0
+	ffzmism	$r4, $r2, $r3
+	beqz	$r4, 1b
+	lb	$r2, [$r0+$r4]
+	lb	$r3, [$r1+$r4]
+	sub	$r0, $r2, $r3
+	ret $lp
+#else /* not (__NDS32_EXT_STRING__) */
+	/* If s1 or s2 are unaligned, then compare bytes.  */
+	or	$r5, $r1, $r0
+	andi    $r5, $r5, #3
+	bnez    $r5, .Lbyte_mode
+
+	/* If s1 and s2 are word-aligned, compare them a word at a time.  */
+	lwi	$r5, [$r0+(0)]
+	lwi	$r3, [$r1+(0)]
+.off_16bit	/* Dedicate 4-byte to eliminate NOP caused by ".align 2".  */
+        /* A difference was detected, so search bytewise.  */
+	bne	$r5, $r3, .Lbyte_mode
+.restore_16bit
+
+
+	/* It's more efficient to set bit mask outside the word_mode loop.  */
+	sethi	$r4, hi20(0xFEFEFEFF)	/* Set $r4 as -0x01010101.  */
+	ori	$r4, $r4, lo12(0xFEFEFEFF)
+	sethi	$r2, hi20(0x80808080)	/* Set $r2 as 0x80808080.  */
+	ori	$r2, $r2, lo12(0x80808080)
+
+.align	2
+.Lword_mode_loop:
+	/* #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+	   DETECTNULL returns nonzero if (long)X contains a NULL byte.  */
+
+/* Force 32-bit instruction to gain better performance.  */
+.off_16bit
+	nor	$r3, $r5, $r5		/* $r3 = ~(X).  */
+	add	$r5, $r5, $r4		/* $r5 = ((X) - 0x01010101).  */
+	and	$r5, $r5, $r3		/* $r5 = ~(X) & ((X) - 0x01010101).  */
+	and	$r5, $r5, $r2		/* $r5= r5 & 0x80808080.  */
+.restore_16bit
+
+	bnez	$r5, .Lfound_null	/* Branch if $r5 is nonzero.  */
+	lmw.aim	$r5, [$r0], $r5, 0
+	lmw.aim	$r3, [$r1], $r3, 0
+	beq	$r5, $r3, .Lword_mode_loop
+
+.align	2
+.Lbyte_mode:
+	/* Byte-mode compare.  */
+	lbi.bi	$r5, [$r0], #1
+	lbi.bi	$r3, [$r1], #1
+	bne	$r5, $r3, 1f	/* Mismatch, done.  */
+	bnez	$r5, .Lbyte_mode
+1:
+	sub $r0, $r5, $r3
+	ret $lp
+
+.align	2
+.Lfound_null:
+	/* To get here, *a1 == *a2, thus if we find a null in *a1,
+	   then the strings must be equal, so return zero.  */
+	movi	$r0, #0
+	ret $lp
+
+#endif /* not (__NDS32_EXT_STRING__) */
+END(strcmp)
+libc_hidden_builtin_def (strcmp)
diff --git a/sysdeps/nds32/strcpy.S b/sysdeps/nds32/strcpy.S
new file mode 100644
index 0000000..31fc282
--- /dev/null
+++ b/sysdeps/nds32/strcpy.S
@@ -0,0 +1,75 @@
+/* Optimized version for Andes nds32.
+   Copyright (C) 2013-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/>.  */
+
+/*  Function:
+       strcpy - copy a string.
+    Syntax:
+       char *strcpy(char *dest, const char *src);
+    Description:
+       This function copies the string pointed to by src into the array
+       point to by dest (include the teminating null character).
+    Return value:
+       strcpy returns the dest as given.  */
+#include <sysdep.h>
+        .text
+
+ENTRY(strcpy)
+	move	$r3, $r0	/* Keep $r0 as reture value.  */
+#if defined (__NDS32_EXT_STRING__)
+1:
+	lmwzb.bm	$r4, [$r1], $r4, #0
+	smwzb.bm	$r4, [$r3], $r4, #0
+	ffzmism	$r2, $r4, $r4
+	beqz	$r2, 1b		/* $r2 = 0, no zero byte exist.  */
+	ret $lp
+
+#else /* not (__NDS32_EXT_STRING__) */
+	GET_GTABLE ($gp)
+	/* If SRC or DEST is unaligned, then copy bytes.  */
+	or	$r2, $r1, $r0
+	andi	$r2, $r2, #3
+	bnez	$r2, .Lbyte_mode
+
+.Lword_mode:
+	/* SRC and DEST are both "long int" aligned, try to do "long int"
+	   sized copies.  */
+	/* #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
+	   DETECTNULL returns nonzero if (long)X contains a NULL byte.  */
+	lwi	$r2, [$r1+(0)]		/* $r2 is X.  */
+	sethi	$r4, hi20(0xFEFEFEFF)
+	ori	$r4, $r4, lo12(0xFEFEFEFF)
+	add	$r4, $r2, $r4		/* $r4 = ((X) - 0x01010101).  */
+	nor	$r5, $r2, $r2		/* $r5 = ~(X).  */
+	and	$r4, $r5, $r4		/* $r4 = ~(X) & ((X) - 0x01010101).  */
+	sethi	$r5, hi20(0x80808080)
+	ori	$r5, $r5, lo12(0x80808080)
+	and	$r4, $r4, $r5		/* $r4 = $r4 & 0x80808080.  */
+	bnez	$r4, .Lbyte_mode	/* Contains a NULL byte.  */
+	swi.bi	$r2, [$r3], #4
+	addi	$r1, $r1, #4
+	b	.Lword_mode
+
+.Lbyte_mode:
+	lbi.bi	$r4, [$r1], #1		/* $r4  <- *src++.  */
+	sbi.bi	$r4, [$r3], #1		/* $r4  -> *dest++.  */
+	bnez	$r4, .Lbyte_mode
+	ret $lp
+#endif /* not (__NDS32_EXT_STRING__) */
+END(strcpy)
+libc_hidden_builtin_def (strcpy)
diff --git a/sysdeps/nds32/sysdep.h b/sysdeps/nds32/sysdep.h
new file mode 100644
index 0000000..e82121c
--- /dev/null
+++ b/sysdeps/nds32/sysdep.h
@@ -0,0 +1,70 @@
+/* Assembler macros for Andes nds32.
+   Copyright (C) 2015-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>
+
+#ifdef	__ASSEMBLER__
+
+/* Define an entry point visible from C.  */
+# ifdef PIC
+#  define ENTRY(name)                     \
+   .pic					  \
+   .align 2;                              \
+   .globl C_SYMBOL_NAME(name);            \
+   .func  C_SYMBOL_NAME(name);            \
+   .type  C_SYMBOL_NAME(name), @function; \
+   C_SYMBOL_NAME(name):			  \
+   cfi_startproc;
+# else
+#  define ENTRY(name)                     \
+   .align 2;                              \
+   .globl C_SYMBOL_NAME(name);            \
+   .func  C_SYMBOL_NAME(name);            \
+   .type  C_SYMBOL_NAME(name), @function; \
+   C_SYMBOL_NAME(name):			  \
+   cfi_startproc;
+# endif
+
+
+# undef END
+# define END(name)    \
+  cfi_endproc;	      \
+  .endfunc;           \
+  .size C_SYMBOL_NAME(name), .-C_SYMBOL_NAME(name)
+
+/* If compiled for profiling, call `mcount' at the start of each function.  */
+# ifdef HAVE_ELF
+#  undef NO_UNDERSCORES
+#  define NO_UNDERSCORES
+# endif
+
+# ifdef NO_UNDERSCORES
+#  define syscall_error __syscall_error
+# endif
+
+
+# define GET_GTABLE(reg)					\
+	sethi	reg,	hi20(_GLOBAL_OFFSET_TABLE_ - 8);	\
+	ori	reg,	reg,	lo12(_GLOBAL_OFFSET_TABLE_ - 4);\
+	add5.pc reg;
+
+
+
+#endif	/* __ASSEMBLER__ */
+  
+
diff --git a/sysdeps/nds32/tst-audit.h b/sysdeps/nds32/tst-audit.h
new file mode 100644
index 0000000..4294bc0
--- /dev/null
+++ b/sysdeps/nds32/tst-audit.h
@@ -0,0 +1,23 @@
+/* Definitions for testing PLT entry/exit auditing.  Andes nds32 version.
+   Copyright (C) 2013-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_nds32_gnu_pltenter
+#define pltexit la_nds32_gnu_pltexit
+#define La_regs La_nds32_regs
+#define La_retval La_nds32_retval
+#define int_retval lrv_reg[0]
diff --git a/sysdeps/unix/sysv/linux/nds32/jmp_buf-macros.h b/sysdeps/unix/sysv/linux/nds32/jmp_buf-macros.h
new file mode 100644
index 0000000..7d7a141
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/nds32/jmp_buf-macros.h
@@ -0,0 +1,26 @@
+/* jump buffer constants, Andes nds32.
+   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/>.  */
+
+#define JMP_BUF_SIZE 184
+#define SIGJMP_BUF_SIZE 184
+#define JMP_BUF_ALIGN 8
+#define SIGJMP_BUF_ALIGN 8
+#define MASK_WAS_SAVED_OFFSET 52
+#define SAVED_MASK_OFFSET 56
+
diff --git a/sysdeps/unix/sysv/linux/nds32/localplt.data b/sysdeps/unix/sysv/linux/nds32/localplt.data
new file mode 100644
index 0000000..14c02cb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/nds32/localplt.data
@@ -0,0 +1,19 @@
+# See scripts/check-localplt.awk for how this file is processed.
+# PLT use is required for the malloc family and for matherr because
+# users can define their own functions and have library internals call them.
+libc.so: calloc
+libc.so: free
+libc.so: malloc
+libc.so: memalign
+libc.so: realloc
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
+ld.so: malloc
+ld.so: calloc
+ld.so: realloc
+ld.so: free
+# The TLS-enabled version of these functions is interposed from libc.so.
+ld.so: _dl_signal_error
+ld.so: _dl_catch_error
+ld.so: _dl_signal_exception
+ld.so: _dl_catch_exception
