This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

crosstool, sparc64, linux 2.6.4, gcc 3.3.3, glibc 2.3.2 success


Hi,

Well for the fun, I tried building a sparc64 cross compiler
using the crosstool-0.27 and after a few tries successfully
built a x86(host) to sparc64(target) compiler.  I haven't
run the testsuite(s) but the 2.6.4 linux kernel built successfully.

Could the below changes be included in the next release of crosstools?

Thanks,
Martin Van Leeuwen

Here are the glibc-2.3.2 changes needed:

Attachment 1:  glibc-2.3.2-pause.patch
               fixes an incorrect header include path for pause.c

Attachment 2:  glibc-2.3.2-pwrite64.patch
               fixes the syscall name changes in kernel 2.5.30 and later

Attachment 3:  glibc-2.3.2-sigproc.patch
               fixes undefined reference to __sigprocmask

Then for crosstools-0.27

Attachment 4: sparc64-dat.patch
              updates to tell the assembler to use CPU v9a,
              -mcpu=ultrasparc3 isn't enough.

Attachment 5: crosstool.sh.patch
              1. update kernel header make command for 2.6.*
              2. teach crosstool about parallel make to optionally
                 speed things up a bit if you have the CPU(s).
../sysdeps/unix/sysv/linux/sparc/sparc64/pause.c:1:39: sysdeps/unix/common/pause.c: No such file or directory
make[2]: *** [/cross/build/sparc64-unknown-linux-gnu/gcc-3.3.2-glibc-2.3.2/build-glibc/posix/pause.o] Error 1
make[2]: Leaving directory `/cross/build/sparc64-unknown-linux-gnu/gcc-3.3.2-glibc-2.3.2/glibc-2.3.2/posix'
make[1]: *** [posix/subdir_lib] Error 2
make: *** [all] Error 2
=========================================================================================================================
--- glibc-2.3.2/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c.orig	Sun Mar  7 08:51:20 2004
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c	Sun Mar  7 08:51:29 2004
@@ -1 +1 @@
-#include <sysdeps/unix/common/pause.c>
+#include <sysdeps/posix/pause.c>
Fix for this error:

/cross/crosstool-0.27/build/sparc64-unknown-linux-gnu/gcc-3.3.3-glibc-2.3.2/build-glibc/libc_pic.os(.text+0xc4d28): In function `posix_fallocate64':
: undefined reference to `__GI___pwrite64'
collect2: ld returned 1 exit status
make[1]: *** [/cross/crosstool-0.27/build/sparc64-unknown-linux-gnu/gcc-3.3.3-glibc-2.3.2/build-glibc/libc.so] Error 1

--- glibc-2.3.2/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h.orig	Sat Mar 13 02:01:51 2004
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h	Sat Mar 13 02:02:20 2004
@@ -29,6 +29,16 @@
 #undef SYS_ify
 #define SYS_ify(syscall_name) __NR_##syscall_name
 
+/* This is a kludge to make syscalls.list find these under the names
+   pread and pwrite, since some kernel headers define those names
+   and some define the *64 names for the same system calls.  */
+#if !defined __NR_pread && defined __NR_pread64
+# define __NR_pread __NR_pread64
+#endif
+#if !defined __NR_pwrite && defined __NR_pwrite64
+# define __NR_pwrite __NR_pwrite64
+#endif
+
 #ifdef __ASSEMBLER__
 
 #define LOADSYSCALL(x) mov __NR_##x, %g1
--- glibc-2.3.2/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list.orig	Sat Mar 13 00:21:29 2004
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list	Sat Mar 13 00:51:48 2004
@@ -2,8 +2,8 @@
 
 # Whee! 64-bit systems naturally implement llseek.
 llseek		EXTRA	lseek		C:3	__llseek	llseek	__libc_lseek64 __lseek64 lseek64
-pread		-	pread		C:4	__libc_pread	__libc_pread64 __pread pread __pread64 pread64
-pwrite		-	pwrite		C:4	__libc_pwrite	__libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
+pread		-	pread64		C:4	__libc_pread	__libc_pread64 __pread pread __pread64 pread64
+pwrite		-	pwrite64	C:4	__libc_pwrite	__libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
 fstatfs		-	fstatfs		2	__fstatfs	fstatfs __fstatfs64 fstatfs64
 statfs		-	statfs		2	__statfs	statfs statfs64
 getrlimit	-	getrlimit	2	__getrlimit	getrlimit getrlimit64
Fix this error:

/cross/crosstool-0.27/build/sparc64-unknown-linux-gnu/gcc-3.3.3-glibc-2.3.2/build-glibc/linuxthreads/libpthread_pic.a(ptw-pause.os)(.text+0x2c): In function `pause':
: undefined reference to `__sigprocmask'
collect2: ld returned 1 exit status
make[2]: *** [/cross/crosstool-0.27/build/sparc64-unknown-linux-gnu/gcc-3.3.3-glibc-2.3.2/build-glibc/linuxthreads/libpthread.so] Error 1


--- /cross/sources/glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile	Wed Dec 31 18:00:00 1969
+++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile	Sat Mar 13 10:18:43 2004
@@ -0,0 +1,5 @@
+# glibc makefile fragment for linuxthreads on sparc/sparc64.
+
+ifeq ($(subdir),linuxthreads)
+libpthread-routines += ptw-sigprocmask
+endif

Fix an obvious bug, not sure what it affects though.

--- ./sysdeps/unix/sysv/linux/Makefile	Sat Mar  6 22:38:06 2004
+++ /cross/sources.AOK.bingo/glibc-2.3.2/./sysdeps/unix/sysv/linux/Makefile	Sat Mar 13 10:27:02 2004
@@ -42,7 +42,7 @@
 	 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
 	 LC_ALL=C sort > $(@:.d=.h).new32; \
 	 SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
-	 $(CC) -E -x c $(sysincludes) $< $(addprefix -U,$(64bit-predefine)) \
+	 $(CC) -E -x c $(sysincludes) $< $(addprefix -U,$(32bit-predefine)) \
 	   $(addprefix -D,$(64bit-predefine)) -D_LIBC -dM | \
 	 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
 	 LC_ALL=C sort > $(@:.d=.h).new64; \
--- crosstool-0.27.virgin/sparc64.dat	Sat Jan 31 00:57:36 2004
+++ crosstool-0.27.AOK.bingo/sparc64.dat	Wed Mar 10 08:50:33 2004
@@ -1,3 +1,3 @@
 TARGET=sparc64-unknown-linux-gnu
-TARGET_CFLAGS="-O -mcpu=ultrasparc3"
+TARGET_CFLAGS="-O -mcpu=ultrasparc3 -Wa,-Av9a"
 GCC_EXTRA_CONFIG="--disable-multilib"
--- crosstool-0.27.virgin/crosstool.sh	Sun Feb  1 00:15:35 2004
+++ crosstool-0.27/crosstool.sh	Sun Mar 14 00:34:48 2004
@@ -146,7 +146,11 @@
     yes "" | make ARCH=$ARCH oldconfig
 fi
 
-make ARCH=$ARCH symlinks include/linux/version.h
+# check for kernel version 2.6.*
+case "$LINUX_DIR" in
+*2.6.*) make ARCH=$ARCH include/asm include/linux/version.h;;
+*)      make ARCH=$ARCH symlinks    include/linux/version.h;;
+esac
 
 mkdir -p $HEADERDIR
 cp -r include/linux $HEADERDIR
@@ -164,7 +168,7 @@
     ${BINUTILS_DIR}/configure --target=$TARGET --prefix=$PREFIX --disable-nls ${BINUTILS_EXTRA_CONFIG} $BINUTILS_SYSROOT_ARG
 fi
 
-make all 
+make $PARALLELMFLAGS all 
 make install 
 
 cd ..
@@ -252,7 +256,7 @@
 	--disable-shared
 fi
 
-make all-gcc install-gcc 
+make $PARALLELMFLAGS all-gcc install-gcc
 
 cd ..
 
@@ -295,6 +299,7 @@
 # ...  linux/autoconf.h: No such file or directory 
 # then you need to set the KERNELCONFIG variable to point to a .config file for this arch.
 # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc
+# No need for PARALLELMFLAGS here, Makefile already reads this environment variable
 make
 make install install_root=${SYSROOT} $GLIBC_SYSROOT_ARG
 
@@ -351,7 +356,7 @@
         --enable-long-long
 fi
 
-make all 
+make $PARALLELMFLAGS all 
 make install 
 
 echo "kludge: If the chip does not have a floating point unit "

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]