Browse Source

allow to build nds32 toolchain with old kernel

Waldemar Brodkorb 2 years ago
parent
commit
fb12275836

+ 1 - 0
target/linux/Config.in.kernelversion

@@ -7,6 +7,7 @@ config ADK_TARGET_LINUX_KERNEL_NEW
 choice
 prompt "Linux Kernel version" if !ADK_TARGET_CHOOSE_ARCH
 depends on ADK_TARGET_OS_LINUX
+default ADK_TARGET_LINUX_KERNEL_VERSION_3_10_NDS32 if ADK_TARGET_ARCH_NDS32
 default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_BOARD_BCM28XX
 default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG
 default ADK_TARGET_LINUX_KERNEL_VERSION_GIT if ADK_TARGET_SYSTEM_KINETIS_K70

+ 40 - 0
target/linux/patches/3.10-nds32/futex.patch

@@ -0,0 +1,40 @@
+diff -Nur linux-3.10-nds32.orig/arch/nds32/include/asm/futex.h linux-3.10-nds32/arch/nds32/include/asm/futex.h
+--- linux-3.10-nds32.orig/arch/nds32/include/asm/futex.h	2017-07-31 07:41:18.000000000 +0200
++++ linux-3.10-nds32/arch/nds32/include/asm/futex.h	2019-10-15 22:59:44.514997184 +0200
+@@ -24,10 +24,10 @@
+ #define __futex_atomic_op(insn, ret, oldval, tmp, uaddr, oparg)	\
+ 	smp_mb();						\
+ 	asm volatile(					\
+-	"	movi	$r15, #0\n"				\
+-	"1:	llw	%1, [%2+$r15]\n"			\
++	"	movi	$ta, #0\n"				\
++	"1:	llw	%1, [%2+$ta]\n"			\
+ 	"	" insn "\n"					\
+-	"2:	scw	%0, [%2+$r15]\n"			\
++	"2:	scw	%0, [%2+$ta]\n"			\
+ 	"	beqz	%0, 1b\n"					\
+ 	"	movi	%0, #0\n"				\
+ 	"3:\n"							\
+@@ -47,18 +47,18 @@
+ 
+ 	smp_mb();
+ 	asm volatile(
+-        "       movi    $r15, #0\n"
+-        "1:     llw     %1, [%6 + $r15]\n"
++        "       movi    $ta, #0\n"
++        "1:     llw     %1, [%6 + $ta]\n"
+         "       sub     %3, %1, %4\n"
+         "       cmovz   %2, %5, %3\n"
+         "       cmovn   %2, %1, %3\n"
+-        "2:     scw     %2, [%6 + $r15]\n"
++        "2:     scw     %2, [%6 + $ta]\n"
+         "       beqz    %2, 1b\n"
+         "3:\n                   "
+ 	__futex_atomic_ex_table("%7")
+ 	: "+&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (flags)
+ 	: "r" (oldval), "r" (newval), "r" (uaddr), "i" (-EFAULT)
+-	: "$r15", "memory");
++	: "$ta", "memory");
+ 	smp_mb();
+ 
+ 	*uval = val;

+ 4 - 3
target/nds32/uclibc-ng.config

@@ -1,6 +1,6 @@
 #
 # Automatically generated file; DO NOT EDIT.
-# uClibc-ng 1.0.25 C Library Configuration
+# uClibc-ng 1.0.32 C Library Configuration
 #
 # TARGET_aarch64 is not set
 # TARGET_alpha is not set
@@ -10,6 +10,7 @@
 # TARGET_bfin is not set
 # TARGET_c6x is not set
 # TARGET_cris is not set
+# TARGET_csky is not set
 # TARGET_frv is not set
 # TARGET_h8300 is not set
 # TARGET_hppa is not set
@@ -24,9 +25,11 @@ TARGET_nds32=y
 # TARGET_nios2 is not set
 # TARGET_or1k is not set
 # TARGET_powerpc is not set
+# TARGET_riscv64 is not set
 # TARGET_sh is not set
 # TARGET_sparc is not set
 # TARGET_sparc64 is not set
+# TARGET_tile is not set
 # TARGET_x86_64 is not set
 # TARGET_xtensa is not set
 
@@ -78,7 +81,6 @@ LDSO_RUNPATH_OF_EXECUTABLE=y
 LDSO_SAFE_RUNPATH=y
 LDSO_SEARCH_INTERP_PATH=y
 LDSO_LD_LIBRARY_PATH=y
-LDSO_NO_CLEANUP=y
 UCLIBC_CTOR_DTOR=y
 # LDSO_GNU_HASH_SUPPORT is not set
 # HAS_NO_THREADS is not set
@@ -223,7 +225,6 @@ HARDWIRED_ABSPATH=y
 # Security options
 #
 # UCLIBC_BUILD_PIE is not set
-# UCLIBC_HAS_ARC4RANDOM is not set
 # UCLIBC_HAS_SSP is not set
 # UCLIBC_BUILD_RELRO is not set
 # UCLIBC_BUILD_NOW is not set

+ 1 - 0
toolchain/binutils/Makefile

@@ -44,6 +44,7 @@ ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
 		--strip-components=1 -C $(WRKSRC) binutils
 endif
 	(cd $(WRKBUILD); PATH='$(HOST_PATH)' \
+		LDFLAGS=-ldl \
 		MAKEINFO=true \
 		M4='${STAGING_HOST_DIR}/usr/bin/m4' \
 		$(WRKBUILD)/configure \

+ 0 - 29
toolchain/binutils/patches/nds32-binutils-2.30-branch-open/fls-internal.patch

@@ -1,29 +0,0 @@
-diff -Nur binutils-nds32-binutils-2.30-branch-open.orig/bfd/elf32-nds32.c binutils-nds32-binutils-2.30-branch-open/bfd/elf32-nds32.c
---- binutils-nds32-binutils-2.30-branch-open.orig/bfd/elf32-nds32.c	2018-05-10 22:01:57.000000000 +0200
-+++ binutils-nds32-binutils-2.30-branch-open/bfd/elf32-nds32.c	2018-05-12 09:01:10.000000000 +0200
-@@ -5286,7 +5286,7 @@
- }
- 
- static unsigned int
--fls (register unsigned int x)
-+fls_internal (register unsigned int x)
- {
-   return ffs (x & (-x));
- }
-@@ -6189,14 +6189,14 @@
- 
- 	    if (1 < ones32 (tls_type))
- 	      {
--		eff_tls_type = 1 << (fls (tls_type) - 1);
-+		eff_tls_type = 1 << (fls_internal (tls_type) - 1);
- 		/* TLS model shall be handled in nds32_elf_unify_tls_model ()  */
- 
- 		/* TLS model X -> LE is not implement yet!
- 		 * workaround here!  */
- 		if (eff_tls_type == GOT_TLS_LE)
- 		  {
--		    eff_tls_type = 1 << (fls (tls_type ^ eff_tls_type) - 1);
-+		    eff_tls_type = 1 << (fls_internal (tls_type ^ eff_tls_type) - 1);
- 		  }
- 	      }
-