I got the library to compile with the attached patches, though dynamic
loader crashes early.

In buildroot I changed the architecture name by hand from sparc to
sparc64, otherwise the compiler produced 32-bit files with V9 (64-bit)
instructions. This configuration is not supported by QEMU, so I aimed
for pure 64-bit. I think Sparc64 option needs to be added to
buildroot.

The _Qp_ ops seem to be required by the ABI. This and setjmp patches
are just hacks to get the compilation further. The _Qp_ ops can be
found in glibc, would it be OK to use those?

V9 assembler requires declarations for global register use.

The mem* functions in sparc32 directory did not work. They are
actually used only by the hybrid 32-bit + V9 CPU configuration.
Index: uClibc/libc/sysdeps/linux/sparc/qp_ops.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ uClibc/libc/sysdeps/linux/sparc/qp_ops.c	2007-07-19 20:01:28.000000000 +0000
@@ -0,0 +1,30 @@
+// XXX add ops from glibc sysdeps/sparc/sparc64/soft-fp
+
+#ifdef __sparc_v9__
+
+#define fakedef(name)                                                   \
+    void name(void)                                                     \
+    {                                                                   \
+        printf("Unimplemented %s called, exiting\n", #name);            \
+        exit(-1);                                                       \
+    }
+
+fakedef(_Qp_fne)
+fakedef(_Qp_feq)
+fakedef(_Qp_div)
+fakedef(_Qp_flt)
+fakedef(_Qp_mul)
+fakedef(_Qp_fge)
+fakedef(_Qp_qtoux)
+fakedef(_Qp_uxtoq)
+fakedef(_Qp_sub)
+fakedef(_Qp_dtoq)
+fakedef(_Qp_qtod)
+fakedef(_Qp_qtos)
+fakedef(_Qp_stoq)
+fakedef(_Qp_itoq)
+fakedef(_Qp_add)
+#undef fakedef
+
+#endif
+
Index: uClibc/libc/sysdeps/linux/sparc/Makefile.arch
===================================================================
--- uClibc.orig/libc/sysdeps/linux/sparc/Makefile.arch	2007-07-19 19:45:30.000000000 +0000
+++ uClibc/libc/sysdeps/linux/sparc/Makefile.arch	2007-07-19 19:55:53.000000000 +0000
@@ -5,7 +5,7 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-CSRC := brk.c __syscall_error.c
+CSRC := brk.c __syscall_error.c qp_ops.c
 
 SSRC := \
 	__longjmp.S fork.S vfork.S clone.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
Index: uClibc/libc/sysdeps/linux/sparc/_math_inc.h
===================================================================
--- uClibc.orig/libc/sysdeps/linux/sparc/_math_inc.h	2007-07-18 07:11:00.000000000 +0000
+++ uClibc/libc/sysdeps/linux/sparc/_math_inc.h	2007-07-19 09:54:24.000000000 +0000
@@ -7,7 +7,9 @@
 #include <bits/wordsize.h>
 
 #define __ASSEMBLY__
+#ifndef __sparc_v9__
 #include <asm/traps.h>
+#endif
 
 #if __WORDSIZE == 32
 # define ENTRY_ALIGN 4
Index: uClibc/libc/sysdeps/linux/sparc/bits/setjmp.h
===================================================================
--- uClibc.orig/libc/sysdeps/linux/sparc/bits/setjmp.h	2007-07-18 07:10:59.000000000 +0000
+++ uClibc/libc/sysdeps/linux/sparc/bits/setjmp.h	2007-07-19 09:54:22.000000000 +0000
@@ -25,7 +25,7 @@
 
 #include <bits/wordsize.h>
 
-#if __WORDSIZE == 64
+#if 0 /*__WORDSIZE == 64*/
 
 #ifndef _ASM
 typedef struct __sparc64_jmp_buf
Index: uClibc/libc/sysdeps/linux/sparc/__longjmp.S
===================================================================
--- uClibc.orig/libc/sysdeps/linux/sparc/__longjmp.S	2007-07-18 07:11:00.000000000 +0000
+++ uClibc/libc/sysdeps/linux/sparc/__longjmp.S	2007-07-19 09:54:19.000000000 +0000
@@ -30,7 +30,8 @@
 .type   __longjmp,%function
 .align 4
 __longjmp:
-
+	.register %g2, #scratch
+	.register %g3, #scratch
 	/* Store our arguments in global registers so we can still
 	 * use them while unwinding frames and their register windows.  */
 
Index: uClibc/ldso/ldso/sparc/dl-startup.h
===================================================================
--- uClibc.orig/ldso/ldso/sparc/dl-startup.h	2007-07-18 07:10:22.000000000 +0000
+++ uClibc/ldso/ldso/sparc/dl-startup.h	2007-07-19 09:54:19.000000000 +0000
@@ -9,6 +9,7 @@
 	.global _start\n\
 	.type   _start,%function\n\
 	.align 32\n\
+	.register %g2, #scratch\n\
 _start:\n\
 	/* Allocate space for functions to drop their arguments. */\n\
 	sub	%sp, 6*4, %sp\n\
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/memchr.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/memchr.S	2007-07-20 09:07:13.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/memchr.S	2007-07-20 09:07:39.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include "sparc64/memchr.S"
+#include "../../sparc64/memchr.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/memcpy.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/memcpy.S	2007-07-20 09:08:02.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/memcpy.S	2007-07-20 09:08:14.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include "sparc64/sparcv9b/memcpy.S"
+#include "../../sparc64/sparcv9b/memcpy.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/memset.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/memset.S	2007-07-20 09:08:27.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/memset.S	2007-07-20 09:08:44.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include <sparc64/memset.S>
+#include "../../sparc64/memset.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/stpcpy.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/stpcpy.S	2007-07-20 09:08:59.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/stpcpy.S	2007-07-20 09:09:16.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include <sparc64/stpcpy.S>
+#include "../../sparc64/stpcpy.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/strcat.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/strcat.S	2007-07-20 09:09:24.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/strcat.S	2007-07-20 09:09:54.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include <sparc64/strcat.S>
+#include "../../sparc64/strcat.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/strchr.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/strchr.S	2007-07-20 09:10:07.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/strchr.S	2007-07-20 09:10:20.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include <sparc64/strchr.S>
+#include "../../sparc64/strchr.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/strcmp.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/strcmp.S	2007-07-20 09:10:30.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/strcmp.S	2007-07-20 09:10:59.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include <sparc64/strcmp.S>
+#include "../../sparc64/strcmp.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/strcpy.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/strcpy.S	2007-07-20 09:11:10.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/strcpy.S	2007-07-20 09:11:25.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include <sparc64/strcpy.S>
+#include "../../sparc64/strcpy.S"
Index: uClibc/libc/string/sparc/sparc32/sparcv9b/strlen.S
===================================================================
--- uClibc.orig/libc/string/sparc/sparc32/sparcv9b/strlen.S	2007-07-20 09:11:31.000000000 +0000
+++ uClibc/libc/string/sparc/sparc32/sparcv9b/strlen.S	2007-07-20 09:11:47.000000000 +0000
@@ -1,4 +1,4 @@
 #define ASI_PNF     0x82
 #define ASI_BLK_P   0xf0
 #define XCC icc
-#include <sparc64/strlen.S>
+#include "../../sparc64/strlen.S"
Index: uClibc/ldso/include/dl-syscall.h
===================================================================
--- uClibc.orig/ldso/include/dl-syscall.h	2007-07-18 07:10:22.000000000 +0000
+++ uClibc/ldso/include/dl-syscall.h	2007-07-19 09:54:17.000000000 +0000
@@ -16,7 +16,11 @@
 /* Pull in whatever this particular arch's kernel thinks the kernel version of
  * struct stat should look like.  It turns out that each arch has a different
  * opinion on the subject, and different kernel revs use different names... */
+#if defined(__sparc_v9__) && (__WORDSIZE == 64)
+#define kernel_stat64 stat
+#else
 #define kernel_stat stat
+#endif
 #include <bits/kernel_stat.h>
 #include <bits/kernel_types.h>
 
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to