Re: Latest mips/evbmips observations

Michael <[email protected]> Wed, 30 Apr 2014 20:58:25 -0400
Newsgroups gmane.os.netbsd.ports.evbmips,gmane.os.netbsd.ports.mips.devel
Organization The NetBSD Foundation
Message-ID <20140430205825.2f3c932f@connemara>
Hello,

On Wed, 30 Apr 2014 14:40:25 -0500 (CDT)
"John D. Baker" <[email protected]> wrote:

> Lemote YEELOONG, evbmips-mips64el
> 
> So, to complicate matters, I've been building with HAVE_GCC=48.  The
> kernel boots.  Userland mostly works.  Mostly same problems from before,
> a few new wrinkles...

4.8 seems to do not much worse than 4.5 on MIPS.

> The very few packages I managed to build using gcc 4.5.4 (sudo and lynx)
> seem to work fine with the gcc-4.8.3-built kernel/libraries.

I found out where the gcc crash is coming from - it's libgmp, namely
the assembler code. For n32 it uses code that assumes LP64, which leads
to occasional unaligned accesses which in turn crash gcc.
So I made a patch that uses generic C code instead on n32 ( see attachment )
With this, at least gcc doesn't crash anymore and it produced a few
working binaries with -O2.

> Changed behavior:
> 
> > X server:  the undefined symbol issues seem to have been resolved, but
> > now the server complains that it can't load the "int10" module, saying
> 
> Once again failing due to an undefined symbol.  Side effect of gcc48?
> 
> X.Org X Server 1.10.6
> Release Date: 2011-07-08
> X Protocol Version 11, Revision 0
> Build Operating System: NetBSD/evbmips  - 
> Current Operating System: NetBSD chalk.technoskunk.fur 6.99.40 NetBSD 6.99.40 (YEELOONG) #2: Tue Apr 29 12:13:16 CDT 2014  [email protected]:/d0/build/current/obj/mips64el/sys/arch/evbmips/compile/YEELOONG evbmips
> Build Date: 01 August 2011  01:01:00AM
>  
> Current version of pixman: 0.32.4
> 	Before reporting problems, check http://wiki.X.Org
> 	to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> 	(++) from command line, (!!) notice, (II) informational,
> 	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Tue Apr 29 18:06:06 2014
> (==) Using default built-in configuration (12 lines)
> (EE) Failed to load /usr/X11R7/lib/modules/drivers/siliconmotion_drv.so: /usr/X11R7/lib/modules/drivers/siliconmotion_drv.so: Undefined symbol "exaOffscreenFree" (symnum = 101)
> (EE) Failed to load module "siliconmotion" (loader failed, 7)
> (EE) No drivers available.
> 
> Fatal server error:
> no screens found
> 
> Please consult the The X.Org Foundation support 
> 	 at http://wiki.X.Org
>  for help. 
> Please also check the log file at "/var/log/Xorg.0.log" for additional information.

I've seen that too ( or rather, something similar ). Didn't get to investigate yet.

> wscons switching doesn't always repaint the display completely, leaving
> characters from another virtual terminal on the screen.  The specific
> case was running 'lynx' in one terminal with an unordered list displayed.
> Two spaces to the left of each list item a single character from the
> corresponding position of the previous virtual terminal was displayed.

Which driver is that?

have fun
Michael
gmp.patch (text/x-patch, 9.1 KB)
? dist/mpn/mips64/32
Index: lib/libgmp/arch/mips64eb/Makefile.inc
===================================================================
RCS file: /cvsroot/src/external/lgpl3/gmp/lib/libgmp/arch/mips64eb/Makefile.inc,v
retrieving revision 1.5
diff -u -w -r1.5 Makefile.inc
--- lib/libgmp/arch/mips64eb/Makefile.inc	4 Dec 2013 00:49:18 -0000	1.5
+++ lib/libgmp/arch/mips64eb/Makefile.inc	1 May 2014 00:48:23 -0000
@@ -174,6 +174,24 @@
 	sbpi1_div_r_sec.c	mpn/generic/sbpi1_div_sec.c \
 	andn_n.c		mpn/generic/logops_n.c \
 
+.if (defined(CPUFLAGS) && !empty(CPUFLAGS:M-mabi=64))
+GMP_LIMB_BITS=64
+C_SRCS_LIST= \
+	xor_n.c			mpn/generic/logops_n.c \
+	sb_div_r_sec.c		mpn/generic/sb_div_sec.c \
+	nand_n.c		mpn/generic/logops_n.c \
+	nior_n.c		mpn/generic/logops_n.c \
+	hamdist.c		mpn/generic/popham.c \
+	popcount.c		mpn/generic/popham.c \
+	sbpi1_div_qr_sec.c	mpn/generic/sbpi1_div_sec.c \
+	and_n.c			mpn/generic/logops_n.c \
+	ior_n.c			mpn/generic/logops_n.c \
+	sb_div_qr_sec.c		mpn/generic/sb_div_sec.c \
+	xnor_n.c		mpn/generic/logops_n.c \
+	iorn_n.c		mpn/generic/logops_n.c \
+	sbpi1_div_r_sec.c	mpn/generic/sbpi1_div_sec.c \
+	andn_n.c		mpn/generic/logops_n.c \
+
 ASM_SRCS_LIST= \
 	sqr_diagonal.asm	mpn/mips64/sqr_diagonal.asm \
 	add_n.asm		mpn/mips64/add_n.asm \
@@ -185,10 +203,43 @@
 	addmul_1.asm		mpn/mips64/addmul_1.asm \
 	sub_n.asm		mpn/mips64/sub_n.asm \
 
-.if (defined(CPUFLAGS) && !empty(CPUFLAGS:M-mabi=64))
-GMP_LIMB_BITS=64
 .else
 GMP_LIMB_BITS=32
+C_SRCS_LIST= \
+	xor_n.c			mpn/generic/logops_n.c \
+	sb_div_r_sec.c		mpn/generic/sb_div_sec.c \
+	nand_n.c		mpn/generic/logops_n.c \
+	nior_n.c		mpn/generic/logops_n.c \
+	hamdist.c		mpn/generic/popham.c \
+	popcount.c		mpn/generic/popham.c \
+	sbpi1_div_qr_sec.c	mpn/generic/sbpi1_div_sec.c \
+	and_n.c			mpn/generic/logops_n.c \
+	ior_n.c			mpn/generic/logops_n.c \
+	sb_div_qr_sec.c		mpn/generic/sb_div_sec.c \
+	xnor_n.c		mpn/generic/logops_n.c \
+	iorn_n.c		mpn/generic/logops_n.c \
+	sbpi1_div_r_sec.c	mpn/generic/sbpi1_div_sec.c \
+	andn_n.c		mpn/generic/logops_n.c \
+	addn_n.c		mpn/generic/add_n.c \
+	submul_1.c		mpn/generic/submul_1.c \
+	lshift.c		mpn/generic/lshift.c \
+	mul_1.c			mpn/generic/mul_1.c \
+	rshift.c		mpn/generic/rshift.c \
+	sub_n.c			mpn/generic/sub_n.c \
+	addmul_1.c		mpn/generic/addmul_1.c \
+
+ASM_SRCS_LIST= \
+#	add_n.asm		mpn/mips32/add_n.asm \
+#	submul_1.asm		mpn/mips32/submul_1.asm \
+#	umul.asm		mpn/mips32/umul.asm \
+#	lshift.asm		mpn/mips32/lshift.asm \
+#	mul_1.asm		mpn/mips32/mul_1.asm \
+#	rshift.asm		mpn/mips32/rshift.asm \
+#	addmul_1.asm		mpn/mips32/addmul_1.asm \
+#	sub_n.asm		mpn/mips32/sub_n.asm \
+
 .endif
 
 COPTS+=		-Wno-error
+
+COPTS+=		-Wno-error
Index: lib/libgmp/arch/mips64eb/config.h
===================================================================
RCS file: /cvsroot/src/external/lgpl3/gmp/lib/libgmp/arch/mips64eb/config.h,v
retrieving revision 1.4
diff -u -w -r1.4 config.h
--- lib/libgmp/arch/mips64eb/config.h	29 Nov 2013 13:26:16 -0000	1.4
+++ lib/libgmp/arch/mips64eb/config.h	1 May 2014 00:48:23 -0000
@@ -221,9 +221,13 @@
 
 /* Define to 1 each of the following for which a native (ie. CPU specific)
     implementation of the corresponding routine exists.  */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_add_n 1
+#endif
 /* #undef HAVE_NATIVE_mpn_add_n_sub_n */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_add_nc 1
+#endif
 /* #undef HAVE_NATIVE_mpn_addaddmul_1msb0 */
 /* #undef HAVE_NATIVE_mpn_addcnd_n */
 /* #undef HAVE_NATIVE_mpn_addlsh1_n */
@@ -272,7 +276,9 @@
 /* #undef HAVE_NATIVE_mpn_invert_limb */
 /* #undef HAVE_NATIVE_mpn_ior_n */
 /* #undef HAVE_NATIVE_mpn_iorn_n */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_lshift 1
+#endif
 /* #undef HAVE_NATIVE_mpn_lshiftc */
 /* #undef HAVE_NATIVE_mpn_lshsub_n */
 /* #undef HAVE_NATIVE_mpn_mod_1 */
@@ -283,7 +289,9 @@
 /* #undef HAVE_NATIVE_mpn_mod_34lsub1 */
 /* #undef HAVE_NATIVE_mpn_modexact_1_odd */
 /* #undef HAVE_NATIVE_mpn_modexact_1c_odd */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_mul_1 1
+#endif
 /* #undef HAVE_NATIVE_mpn_mul_1c */
 /* #undef HAVE_NATIVE_mpn_mul_2 */
 /* #undef HAVE_NATIVE_mpn_mul_3 */
@@ -308,12 +316,18 @@
 /* #undef HAVE_NATIVE_mpn_rsh1add_nc */
 /* #undef HAVE_NATIVE_mpn_rsh1sub_n */
 /* #undef HAVE_NATIVE_mpn_rsh1sub_nc */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_rshift 1
+#endif
 /* #undef HAVE_NATIVE_mpn_sqr_basecase */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_sqr_diagonal 1
+#endif
 /* #undef HAVE_NATIVE_mpn_sqr_diag_addlsh1 */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_sub_n 1
 #define HAVE_NATIVE_mpn_sub_nc 1
+#endif
 /* #undef HAVE_NATIVE_mpn_subcnd_n */
 /* #undef HAVE_NATIVE_mpn_sublsh1_n */
 /* #undef HAVE_NATIVE_mpn_sublsh2_n */
@@ -331,7 +345,9 @@
 /* #undef HAVE_NATIVE_mpn_tabselect */
 /* #undef HAVE_NATIVE_mpn_udiv_qrnnd */
 /* #undef HAVE_NATIVE_mpn_udiv_qrnnd_r */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_umul_ppmm 1
+#endif
 /* #undef HAVE_NATIVE_mpn_umul_ppmm_r */
 /* #undef HAVE_NATIVE_mpn_xor_n */
 /* #undef HAVE_NATIVE_mpn_xnor_n */
Index: lib/libgmp/arch/mips64el/Makefile.inc
===================================================================
RCS file: /cvsroot/src/external/lgpl3/gmp/lib/libgmp/arch/mips64el/Makefile.inc,v
retrieving revision 1.5
diff -u -w -r1.5 Makefile.inc
--- lib/libgmp/arch/mips64el/Makefile.inc	4 Dec 2013 00:49:18 -0000	1.5
+++ lib/libgmp/arch/mips64el/Makefile.inc	1 May 2014 00:48:23 -0000
@@ -158,6 +158,8 @@
 	redc_n.c \
 	sub_err1_n.c \
 
+.if (defined(CPUFLAGS) && !empty(CPUFLAGS:M-mabi=64))
+GMP_LIMB_BITS=64
 C_SRCS_LIST= \
 	xor_n.c			mpn/generic/logops_n.c \
 	sb_div_r_sec.c		mpn/generic/sb_div_sec.c \
@@ -185,10 +187,41 @@
 	addmul_1.asm		mpn/mips64/addmul_1.asm \
 	sub_n.asm		mpn/mips64/sub_n.asm \
 
-.if (defined(CPUFLAGS) && !empty(CPUFLAGS:M-mabi=64))
-GMP_LIMB_BITS=64
 .else
 GMP_LIMB_BITS=32
+C_SRCS_LIST= \
+	xor_n.c			mpn/generic/logops_n.c \
+	sb_div_r_sec.c		mpn/generic/sb_div_sec.c \
+	nand_n.c		mpn/generic/logops_n.c \
+	nior_n.c		mpn/generic/logops_n.c \
+	hamdist.c		mpn/generic/popham.c \
+	popcount.c		mpn/generic/popham.c \
+	sbpi1_div_qr_sec.c	mpn/generic/sbpi1_div_sec.c \
+	and_n.c			mpn/generic/logops_n.c \
+	ior_n.c			mpn/generic/logops_n.c \
+	sb_div_qr_sec.c		mpn/generic/sb_div_sec.c \
+	xnor_n.c		mpn/generic/logops_n.c \
+	iorn_n.c		mpn/generic/logops_n.c \
+	sbpi1_div_r_sec.c	mpn/generic/sbpi1_div_sec.c \
+	andn_n.c		mpn/generic/logops_n.c \
+	addn_n.c		mpn/generic/add_n.c \
+	submul_1.c		mpn/generic/submul_1.c \
+	lshift.c		mpn/generic/lshift.c \
+	mul_1.c			mpn/generic/mul_1.c \
+	rshift.c		mpn/generic/rshift.c \
+	sub_n.c			mpn/generic/sub_n.c \
+	addmul_1.c		mpn/generic/addmul_1.c \
+
+ASM_SRCS_LIST= \
+#	add_n.asm		mpn/mips32/add_n.asm \
+#	submul_1.asm		mpn/mips32/submul_1.asm \
+#	umul.asm		mpn/mips32/umul.asm \
+#	lshift.asm		mpn/mips32/lshift.asm \
+#	mul_1.asm		mpn/mips32/mul_1.asm \
+#	rshift.asm		mpn/mips32/rshift.asm \
+#	addmul_1.asm		mpn/mips32/addmul_1.asm \
+#	sub_n.asm		mpn/mips32/sub_n.asm \
+
 .endif
 
 COPTS+=		-Wno-error
Index: lib/libgmp/arch/mips64el/config.h
===================================================================
RCS file: /cvsroot/src/external/lgpl3/gmp/lib/libgmp/arch/mips64el/config.h,v
retrieving revision 1.4
diff -u -w -r1.4 config.h
--- lib/libgmp/arch/mips64el/config.h	29 Nov 2013 13:26:16 -0000	1.4
+++ lib/libgmp/arch/mips64el/config.h	1 May 2014 00:48:23 -0000
@@ -221,9 +221,13 @@
 
 /* Define to 1 each of the following for which a native (ie. CPU specific)
     implementation of the corresponding routine exists.  */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_add_n 1
+#endif
 /* #undef HAVE_NATIVE_mpn_add_n_sub_n */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_add_nc 1
+#endif
 /* #undef HAVE_NATIVE_mpn_addaddmul_1msb0 */
 /* #undef HAVE_NATIVE_mpn_addcnd_n */
 /* #undef HAVE_NATIVE_mpn_addlsh1_n */
@@ -272,7 +276,9 @@
 /* #undef HAVE_NATIVE_mpn_invert_limb */
 /* #undef HAVE_NATIVE_mpn_ior_n */
 /* #undef HAVE_NATIVE_mpn_iorn_n */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_lshift 1
+#endif
 /* #undef HAVE_NATIVE_mpn_lshiftc */
 /* #undef HAVE_NATIVE_mpn_lshsub_n */
 /* #undef HAVE_NATIVE_mpn_mod_1 */
@@ -283,7 +289,9 @@
 /* #undef HAVE_NATIVE_mpn_mod_34lsub1 */
 /* #undef HAVE_NATIVE_mpn_modexact_1_odd */
 /* #undef HAVE_NATIVE_mpn_modexact_1c_odd */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_mul_1 1
+#endif
 /* #undef HAVE_NATIVE_mpn_mul_1c */
 /* #undef HAVE_NATIVE_mpn_mul_2 */
 /* #undef HAVE_NATIVE_mpn_mul_3 */
@@ -308,12 +316,20 @@
 /* #undef HAVE_NATIVE_mpn_rsh1add_nc */
 /* #undef HAVE_NATIVE_mpn_rsh1sub_n */
 /* #undef HAVE_NATIVE_mpn_rsh1sub_nc */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_rshift 1
+#endif
 /* #undef HAVE_NATIVE_mpn_sqr_basecase */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_sqr_diagonal 1
+#endif
 /* #undef HAVE_NATIVE_mpn_sqr_diag_addlsh1 */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_sub_n 1
+#endif
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_sub_nc 1
+#endif
 /* #undef HAVE_NATIVE_mpn_subcnd_n */
 /* #undef HAVE_NATIVE_mpn_sublsh1_n */
 /* #undef HAVE_NATIVE_mpn_sublsh2_n */
@@ -331,7 +347,9 @@
 /* #undef HAVE_NATIVE_mpn_tabselect */
 /* #undef HAVE_NATIVE_mpn_udiv_qrnnd */
 /* #undef HAVE_NATIVE_mpn_udiv_qrnnd_r */
+#ifdef _LP64
 #define HAVE_NATIVE_mpn_umul_ppmm 1
+#endif
 /* #undef HAVE_NATIVE_mpn_umul_ppmm_r */
 /* #undef HAVE_NATIVE_mpn_xor_n */
 /* #undef HAVE_NATIVE_mpn_xnor_n */