diff -Nuar bash-5.1.8.org/configure bash-5.1.8.sw/configure
--- bash-5.1.8.org/configure	2021-10-15 16:12:05.691193735 +0800
+++ bash-5.1.8.sw/configure	2021-10-15 16:32:01.231145759 +0800
@@ -2890,6 +2890,7 @@
 case "${host_cpu}-${host_os}" in
 # mostly obsolete platforms
 alpha*-*)	opt_bash_malloc=no ;;	# alpha running osf/1 or linux
+sw_64*-*)	opt_bash_malloc=no ;;	# sw_64 running osf/1 or linux
 *[Cc]ray*-*)	opt_bash_malloc=no ;;	# Crays
 *-osf1*)	opt_bash_malloc=no ;;	# other osf/1 machines
 *-dgux*)	opt_bash_malloc=no ;;	# DG/UX machines
@@ -7875,7 +7876,7 @@
 
             # Guess based on the CPU.
             case "$host_cpu" in
-              alpha* | i[34567]86 | x86_64 | m68k | s390*)
+              sw_64* | alpha* | i[34567]86 | x86_64 | m68k | s390*)
                 gt_cv_int_divbyzero_sigfpe="guessing yes";;
               *)
                 gt_cv_int_divbyzero_sigfpe="guessing no";;
diff -Nuar bash-5.1.8.org/configure.ac bash-5.1.8.sw/configure.ac
--- bash-5.1.8.org/configure.ac	2021-10-15 16:12:05.727193733 +0800
+++ bash-5.1.8.sw/configure.ac	2021-10-15 16:32:26.167144759 +0800
@@ -65,6 +65,7 @@
 case "${host_cpu}-${host_os}" in
 # mostly obsolete platforms
 alpha*-*)	opt_bash_malloc=no ;;	# alpha running osf/1 or linux
+sw_64*-*)	opt_bash_malloc=no ;;	# sw_64 running osf/1 or linux
 *[[Cc]]ray*-*)	opt_bash_malloc=no ;;	# Crays
 *-osf1*)	opt_bash_malloc=no ;;	# other osf/1 machines
 *-dgux*)	opt_bash_malloc=no ;;	# DG/UX machines
diff -Nuar bash-5.1.8.org/general.h bash-5.1.8.sw/general.h
--- bash-5.1.8.org/general.h	2021-10-15 16:12:05.726193734 +0800
+++ bash-5.1.8.sw/general.h	2021-10-15 16:28:55.053153230 +0800
@@ -57,7 +57,7 @@
 /* Hardly used anymore */
 #define pointer_to_int(x)	(int)((char *)x - (char *)0)
 
-#if defined (alpha) && defined (__GNUC__) && !defined (strchr) && !defined (__STDC__)
+#if (defined (alpha) || defined (sw_64)) && defined (__GNUC__) && !defined (strchr) && !defined (__STDC__)
 extern char *strchr (), *strrchr ();
 #endif
 
diff -Nuar bash-5.1.8.org/lib/intl/dcigettext.c bash-5.1.8.sw/lib/intl/dcigettext.c
--- bash-5.1.8.org/lib/intl/dcigettext.c	2021-10-15 16:12:05.686193735 +0800
+++ bash-5.1.8.sw/lib/intl/dcigettext.c	2021-10-15 16:28:45.480153615 +0800
@@ -74,7 +74,7 @@
 #ifdef _LIBC
   /* Guess whether integer division by zero raises signal SIGFPE.
      Set to 1 only if you know for sure.  In case of doubt, set to 0.  */
-# if defined __alpha__ || defined __arm__ || defined __i386__ \
+# if defined __alpha__ || defined __sw_64__ || defined __arm__ || defined __i386__ \
      || defined __m68k__ || defined __s390__
 #  define INTDIV0_RAISES_SIGFPE 1
 # else
diff -Nuar bash-5.1.8.org/m4/host-cpu-c-abi.m4 bash-5.1.8.sw/m4/host-cpu-c-abi.m4
--- bash-5.1.8.org/m4/host-cpu-c-abi.m4	2021-10-15 16:12:05.726193734 +0800
+++ bash-5.1.8.sw/m4/host-cpu-c-abi.m4	2021-10-15 16:26:05.539160033 +0800
@@ -91,6 +91,12 @@
          ;;
 
 changequote(,)dnl
+       sw_64* )
+changequote([,])dnl
+         gl_cv_host_cpu_c_abi=sw_64
+         ;;
+
+changequote(,)dnl
        alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
 changequote([,])dnl
          gl_cv_host_cpu_c_abi=alpha
@@ -355,6 +361,9 @@
 #ifndef __x86_64__
 #undef __x86_64__
 #endif
+#ifndef __sw_64__
+#undef __sw_64__
+#endif
 #ifndef __alpha__
 #undef __alpha__
 #endif
diff -Nuar bash-5.1.8.org/m4/intdiv0.m4 bash-5.1.8.sw/m4/intdiv0.m4
--- bash-5.1.8.org/m4/intdiv0.m4	2021-10-15 16:12:05.726193734 +0800
+++ bash-5.1.8.sw/m4/intdiv0.m4	2021-10-15 16:25:19.697161872 +0800
@@ -69,7 +69,7 @@
             # Guess based on the CPU.
 changequote(,)dnl
             case "$host_cpu" in
-              alpha* | i[34567]86 | x86_64 | m68k | s390*)
+              sw_64* | alpha* | i[34567]86 | x86_64 | m68k | s390*)
                 gt_cv_int_divbyzero_sigfpe="guessing yes";;
               *)
                 gt_cv_int_divbyzero_sigfpe="guessing no";;
diff -Nuar bash-5.1.8.org/support/config.guess bash-5.1.8.sw/support/config.guess
--- bash-5.1.8.org/support/config.guess	2021-10-15 16:12:05.690193735 +0800
+++ bash-5.1.8.sw/support/config.guess	2021-10-15 16:21:57.441169989 +0800
@@ -924,6 +924,14 @@
 	UNAME_MACHINE=aarch64_be
 	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
+    sw_64:Linux:*:*)
+	case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
+	  sw)   UNAME_MACHINE=sw_64 ;;
+	esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+	echo "$UNAME_MACHINE"-sunway-linux-"$LIBC"
+	exit ;;
     alpha:Linux:*:*)
 	case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
diff -Nuar bash-5.1.8.org/support/config.sub bash-5.1.8.sw/support/config.sub
--- bash-5.1.8.org/support/config.sub	2021-10-15 16:12:05.690193735 +0800
+++ bash-5.1.8.sw/support/config.sub	2021-10-15 16:18:49.228177541 +0800
@@ -1160,6 +1160,7 @@
 			| a29k \
 			| aarch64 | aarch64_be \
 			| abacus \
+			| sw_64 \
 			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
 			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
 			| alphapca5[67] | alpha64pca5[67] \
