Status of toolchain update?

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

Well spotted. mipsel is just generic Little Endian MIPS. Oh well. :(
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Since it was the easiest starting point. I ported the binutils-2.16.1 patch that adds the IOP's irx elf format to binutils-2.19. It's at http://homebrew.thewaffleiron.net/ragnarok2040. I was able to compile and install it fine. I haven't tested it yet with gcc. I added the gcc-4.3 configure target changes to gcc-4.3.2 to build for a mips*-*-*irx target but for some reason the configure script can't seem to parse the mips-irx target I passed to it.

The only thing I didn't add to the patch was the commenting of BFD_ASSERT (r_symndx != 0); at line 9427 in bfd/elflink.c. While r_symndx was 0 in irx modules produced by previous binutils revisions, there's new code that fills r_symndx with a value from htab->data_index_section->target_index at line 9423 if osec->target_index is 0. Not sure what the effect would be on generated irx modules.

I've been playing around with the new version of binutils, and I needed to add the -mdebug flag for binutils-2.19's as.exe in order to create an object file with the same .mdebug section as iop-as. Without it HAS_RELOC is defined and the section is changed to .pdr. I'm not sure it matters much, as the section probably gets stripped.
yoshi314
Posts: 36
Joined: Sat Jul 26, 2008 11:19 pm

Post by yoshi314 »

that seems like a good start.

did you consider using some kind of a central repository for those patches to make things easier for everyone? (google code would be nice).
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

I'd considered it before but the disk quota for subversion repositories was only 100 MB, but it seems they've increased it to 1 GB around the 13th. I'm not sure if new projects get 1 GB though. gcc-4.3.2 takes up about 353 MB and binutils takes up 109 MB so that's almost half a gig for the iop and ee toolchains each. If I split them up into seperate mipsel-r5900-elf, mips-r3000-irx, dvp-elf (dvp-mips-elf?) projects, there should be enough space to host them all. I'll go create the projects in the next couple of days and ask google for an increase if there's not enough space.
yoshi314
Posts: 36
Joined: Sat Jul 26, 2008 11:19 pm

Post by yoshi314 »

i was interested in such solution, because nowadays it seems that everybody is working on toolchain patches separately from each other.

maybe some kind of solution that would make team effort easier might work out better.

alternatively all this might be hosted on ps2dev svn, but i think google's hosting is generally much faster.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

The first project page is up at http://ps2iop.googlecode.com/. I'm having trouble getting the svn repositories to sync though, google's server sent me a 502 Bad Gateway error in middle of the transfer and not only that, the upload speed is pretty slow at ~3 to 5 KB/s though sometimes I get a burst to 30-50 KB/s. Right now the repository only has the vanilla versions of binutils-2.19 and gcc-4.3.2. Then I'll check out a local copy and apply the binutils patch then commit those changes.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

I've just moved house and am on a very slow connection for the moment. I'll be running a server from next month and so I could host if necessary. I very highly recommend Git over Subversion though. I know Git can seem scary at first but I used Subversion for years and haven't looked back since I switched. It's especially appropriate for a project like this.

ragnarok2040, did you see my IOP patch for GCC? It's only small but it is important. Actually, ooPo posted an older version on the first page of this thread. Here's my latest version.

Code: Select all

diff -Naur gcc-4.3-20071123-old/configure.ac gcc-4.3-20071123-new/configure.ac
--- gcc-4.3-20071123-old/configure.ac   2007-11-25 21:51:45.741455304 +0000
+++ gcc-4.3-20071123-new/configure.ac   2007-11-25 21:57:29.238052745 +0000
@@ -807,6 +807,9 @@
   mips*-*-linux*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
+  mips*-*-irx*)
+    noconfigdirs="$noconfigdirs gprof target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
+    ;;
   mips*-*-*)
     noconfigdirs="$noconfigdirs gprof ${libgcj}"
     libgloss_dir=mips
diff -Naur gcc-4.3-20071123-old/gcc/config/mips/iop.h gcc-4.3-20071123-new/gcc/config/mips/iop.h
--- gcc-4.3-20071123-old/gcc/config/mips/iop.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-4.3-20071123-new/gcc/config/mips/iop.h	2007-11-25 21:57:29.238052745 +0000
@@ -0,0 +1,7 @@
+#define DRIVER_SELF_SPECS \
+	"%{!march=*:-march=r3000}",			\
+	"%{!mexplicit-relocs:-mno-explicit-relocs}",	\
+	"%{!fno-unit-at-a-time:-funit-at-a-time}",	\
+	"%{!ftoplevel-reorder:-fno-toplevel-reorder}",	\
+	"%{!fmerge-constants:-fno-merge-constants}",	\
+	"%{!fbuiltin:-fno-builtin}"
diff -Naur gcc-4.3-20071123-old/gcc/config/mips/t-iop gcc-4.3-20071123-new/gcc/config/mips/t-iop
--- gcc-4.3-20071123-old/gcc/config/mips/t-iop	1970-01-01 01:00:00.000000000 +0100
+++ gcc-4.3-20071123-new/gcc/config/mips/t-iop	2007-11-25 21:57:29.239052592 +0000
@@ -0,0 +1,3 @@
+MULTILIB_OPTIONS = 
+MULTILIB_DIRNAMES = 
+MULTILIB_MATCHES = 
diff -Naur gcc-4.3-20071123-old/gcc/config.gcc gcc-4.3-20071123-new/gcc/config.gcc
--- gcc-4.3-20071123-old/gcc/config.gcc	2007-11-25 21:51:45.744454847 +0000
+++ gcc-4.3-20071123-new/gcc/config.gcc	2007-11-25 21:57:29.240052440 +0000
@@ -1794,6 +1794,12 @@
 	tmake_file="mips/t-r3900 mips/t-libgcc-mips16"
 	use_fixproto=yes
 	;;
+mips*-*-irx*)
+	tm_file="elfos.h ${tm_file} mips/elf.h mips/iop.h"
+	tmake_file="mips/t-elf mips/t-gofast mips/t-iop"
+	target_cpu_default="MASK_SOFT_FLOAT"
+	use_fixproto=yes
+	;;
 mmix-knuth-mmixware)
 	need_64bit_hwint=yes
 	;;
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

I've never actually used Git, heh :D. It doesn't look too scary, to me, at least. The cheatsheet helps a bit. Looks easier to understand than subversion anyway, heh. I think I have your latest patches. The original iop patch has the same timestamps as the one you've posted. The r5900 patch has timestamps from February 18th. I can't remember how I got them :?, though I downloaded them recently. I think it was probably when your server was back up for a time.

This is my current patch for gcc-4.3.2, but I've just modified config.sub to add a -irx os target under the -gnu system target.

Code: Select all

diff -Naur gcc-4.3.2-old/configure.ac gcc-4.3.2/configure.ac
--- gcc-4.3.2-old/configure.ac	2008-02-01 22:29:30.000000000 -0500
+++ gcc-4.3.2/configure.ac	2008-11-18 14:17:40.000000000 -0500
@@ -810,6 +810,9 @@
   mips*-*-linux*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
+  mips*-*-irx*)
+    noconfigdirs="$noconfigdirs gprof target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
+    ;;
   mips*-*-*)
     noconfigdirs="$noconfigdirs gprof ${libgcj}"
     libgloss_dir=mips
diff -Naur gcc-4.3.2-old/gcc/config/mips/iop.h gcc-4.3.2/gcc/config/mips/iop.h
--- gcc-4.3.2-old/gcc/config/mips/iop.h	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.3.2/gcc/config/mips/iop.h	2008-11-18 14:17:40.000000000 -0500
@@ -0,0 +1,7 @@
+#define DRIVER_SELF_SPECS \
+	"%{!march=*:-march=r3000}",			\
+	"%{!mexplicit-relocs:-mno-explicit-relocs}",	\
+	"%{!fno-unit-at-a-time:-funit-at-a-time}",	\
+	"%{!ftoplevel-reorder:-fno-toplevel-reorder}",	\
+	"%{!fmerge-constants:-fno-merge-constants}",	\
+	"%{!fbuiltin:-fno-builtin}"
diff -Naur gcc-4.3.2-old/gcc/config/mips/t-iop gcc-4.3.2/gcc/config/mips/t-iop
--- gcc-4.3.2-old/gcc/config/mips/t-iop	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.3.2/gcc/config/mips/t-iop	2008-11-18 14:17:40.000000000 -0500
@@ -0,0 +1,3 @@
+MULTILIB_OPTIONS = 
+MULTILIB_DIRNAMES = 
+MULTILIB_MATCHES = 
diff -Naur gcc-4.3.2-old/gcc/config.gcc gcc-4.3.2/gcc/config.gcc
--- gcc-4.3.2-old/gcc/config.gcc	2008-06-09 12:32:15.000000000 -0400
+++ gcc-4.3.2/gcc/config.gcc	2008-11-18 14:17:40.000000000 -0500
@@ -1825,6 +1825,12 @@
 	tmake_file="mips/t-r3900 mips/t-libgcc-mips16"
 	use_fixproto=yes
 	;;
+mips*-*-irx*)
+	tm_file="elfos.h ${tm_file} mips/elf.h mips/iop.h"
+	tmake_file="mips/t-elf mips/t-gofast mips/t-iop"
+	target_cpu_default="MASK_SOFT_FLOAT"
+	use_fixproto=yes
+	;;
 mmix-knuth-mmixware)
 	need_64bit_hwint=yes
 	;;
Edit:
I also just commented out the target_cpu_default="MASK_SOFT_FLOAT" line and replaced with --with-float=soft in the configure command as MASK_SOFT_FLOAT was erroring out as being undeclared.
yoshi314
Posts: 36
Joined: Sat Jul 26, 2008 11:19 pm

Post by yoshi314 »

I've never actually used Git, heh :D. It doesn't look too scary, to me, at least. The cheatsheet helps a bit. Looks easier to understand than subversion anyway, heh.
you can use svn via git, which simply rocks.

i'm doing it locally at the company i work for with the project i'm assigned to.

you do not need svn server access to commit anything locally. you can push your changes outside to svn later from your git copy. also i *think* git packs the repository much better than svn does, and does better job at removing duplicated files.

http://flavio.castelli.name/howto_use_git_with_svn might be helpful. but i think it's a bit outdated.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

I never patched config.sub because Gentoo automatically replaces it with the latest version when building.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

Ahh, :D. I think I've got it sorted out :?.

Code: Select all

diff -Naur gcc-4.3.2-old/config.sub gcc-4.3.2/config.sub
--- gcc-4.3.2-old/config.sub	2008-01-22 21:37:40.000000000 -0500
+++ gcc-4.3.2/config.sub	2008-12-22 07:05:07.000000000 -0500
@@ -1258,7 +1258,7 @@
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1642,6 +1642,9 @@
 			-vos*)
 				vendor=stratus
 				;;
+			-irx*)
+				vendor=sony
+				;;
 		esac
 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
 		;;
diff -Naur gcc-4.3.2-old/configure.ac gcc-4.3.2/configure.ac
--- gcc-4.3.2-old/configure.ac	2008-02-01 22:29:30.000000000 -0500
+++ gcc-4.3.2/configure.ac	2008-12-22 06:00:32.000000000 -0500
@@ -810,6 +810,9 @@
   mips*-*-linux*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
+  mips*-*-irx*)
+    noconfigdirs="$noconfigdirs gprof target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
+    ;;
   mips*-*-*)
     noconfigdirs="$noconfigdirs gprof ${libgcj}"
     libgloss_dir=mips
diff -Naur gcc-4.3.2-old/gcc/config/mips/iop.h gcc-4.3.2/gcc/config/mips/iop.h
--- gcc-4.3.2-old/gcc/config/mips/iop.h	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.3.2/gcc/config/mips/iop.h	2008-12-22 02:59:13.000000000 -0500
@@ -0,0 +1,7 @@
+#define DRIVER_SELF_SPECS \
+	"%{!march=*:-march=r3000}",			\
+	"%{!mexplicit-relocs:-mno-explicit-relocs}",	\
+	"%{!fno-unit-at-a-time:-funit-at-a-time}",	\
+	"%{!ftoplevel-reorder:-fno-toplevel-reorder}",	\
+	"%{!fmerge-constants:-fno-merge-constants}",	\
+	"%{!fbuiltin:-fno-builtin}"
diff -Naur gcc-4.3.2-old/gcc/config/mips/t-iop gcc-4.3.2/gcc/config/mips/t-iop
--- gcc-4.3.2-old/gcc/config/mips/t-iop	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.3.2/gcc/config/mips/t-iop	2008-12-22 05:49:53.000000000 -0500
@@ -0,0 +1,25 @@
+# Don't let CTOR_LIST end up in sdata section.
+CRTSTUFF_T_CFLAGS = -G 0
+
+# Assemble startup files.
+$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
+	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+	-c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
+
+$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
+	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+	-c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
+
+# We must build libgcc2.a with -G 0, in case the user wants to link
+# without the $gp register.
+TARGET_LIBGCC2_CFLAGS = -G 0
+
+# Build the libraries for both hard and soft floating point
+
+MULTILIB_OPTIONS = msoft-float EL
+MULTILIB_DIRNAMES = soft-float el
+MULTILIB_MATCHES = EL=mel
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
diff -Naur gcc-4.3.2-old/gcc/config/mips/t-irx gcc-4.3.2/gcc/config/mips/t-irx
--- gcc-4.3.2-old/gcc/config/mips/t-irx	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.3.2/gcc/config/mips/t-irx	2008-12-22 04:10:21.000000000 -0500
@@ -0,0 +1,3 @@
+MULTILIB_OPTIONS = msoft-float EL
+MULTILIB_DIRNAMES = soft-float el eb
+MULTILIB_MATCHES = EL=mel
diff -Naur gcc-4.3.2-old/gcc/config.gcc gcc-4.3.2/gcc/config.gcc
--- gcc-4.3.2-old/gcc/config.gcc	2008-06-09 12:32:15.000000000 -0400
+++ gcc-4.3.2/gcc/config.gcc	2008-12-22 03:32:18.000000000 -0500
@@ -609,6 +609,10 @@
   # Assume that newlib is being used and so __cxa_atexit is provided.
   default_use_cxa_atexit=yes
   ;;
+*-*-irx)
+  # Assume that newlib is being used and so __cxa_atexit is provided.
+  default_use_cxa_atexit=yes
+  ;;
 esac
 
 case ${target} in
@@ -1825,6 +1829,12 @@
 	tmake_file="mips/t-r3900 mips/t-libgcc-mips16"
 	use_fixproto=yes
 	;;
+mips-*-irx* | mipsel-*-irx*)
+	tm_file="elfos.h ${tm_file} mips/elf.h mips/iop.h"
+	tmake_file="mips/t-elf mips/t-gofast mips/t-iop"
+#	target_cpu_default="MASK_SOFT_FLOAT"
+	use_fixproto=yes
+	;;
 mmix-knuth-mmixware)
 	need_64bit_hwint=yes
 	;;
diff -Naur gcc-4.3.2-old/libgcc/config.host gcc-4.3.2/libgcc/config.host
--- gcc-4.3.2-old/libgcc/config.host	2008-01-25 15:49:04.000000000 -0500
+++ gcc-4.3.2/libgcc/config.host	2008-12-22 04:41:29.000000000 -0500
@@ -444,6 +444,8 @@
 	;;
 mips-*-elf* | mipsel-*-elf*)
 	;;
+mips-*-irx* | mipsel-*-irx*)
+	;;
 mips64-*-elf* | mips64el-*-elf*)
 	;;
 mips64vr-*-elf* | mips64vrel-*-elf*)
Identifies itself as mips-sony-irx now. I modified the t-irx configuration file to be mostly the same as t-elf except to remove the big endian stuff and msingle-float=m4650.

I configured it with --target=mips-irx --with-float=soft --enable-languages=c --disable-shared --disable-libssp. I should probably have included --disable-multilib as well but it built fine.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

We need to agree on the machine names or we're going to get in a mess. Just mips is okay for the IOP since it is a very generic MIPS. mips64r5900el is the official name for the R5900 according to the latest config.sub. It is important to follow this file because other packages include config.sub from here.

The company name is generally less important but the most official one I've seen is scei, despite the fact that config.sub doesn't mention it. I would prefer this over sony.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

I just used sony because that's what it seems the gcc developers were using. I agree it should be scei. Thanks for the link to the latest config.sub. I remembered you said that they'd changed the name from vr5900 to r5900 but it was still vr5900 in 4.3.2

I gave up on googlecode. It keeps giving me that 502 Bad Gateway error and then I have to restart the sync which causes it to upload from the beginning. Maybe gitorious will work, but I can't seem to find what their hosting limits are. I've seen a couple of projects based on gcc there, so it might work. I'll play around with git to get some experience with it in the meantime.

Edit:
Sourceforge approved my request for a project page. The url is http://sourceforge.net/projects/ps2toolchain. I've uploaded a bare-bones repository for the toolchains but they only currently have the vanilla versions of gcc-4.3.2 and binutils-2.19 per each toolchain. I'll commit the changes for the iop toolchain when I get a working copy checked out.

Edit2:
I've just committed both binutils and gcc patches for the iop toolchain in one big commit. I've built the toolchain and tested it trying to build ps2sdk, but mips-irx-ld is segfaulting when linking.

Code: Select all

#0  0x080659fa in gldmipsirx_after_parse () at emipsirx.c:143
143	  for (stat = iopmod_section_statement->header.next; stat != NULL;
I don't see anything wrong with the loop that springs to mind. I'll look at it more closely tomorrow.
cyt0plas
Posts: 2
Joined: Mon Jan 26, 2009 3:34 pm

Post by cyt0plas »

ragnarok2040 wrote:I'd considered it before but the disk quota for subversion repositories was only 100 MB, but it seems they've increased it to 1 GB around the 13th. I'm not sure if new projects get 1 GB though. gcc-4.3.2 takes up about 353 MB and binutils takes up 109 MB so that's almost half a gig for the iop and ee toolchains each. If I split them up into seperate mipsel-r5900-elf, mips-r3000-irx, dvp-elf (dvp-mips-elf?) projects, there should be enough space to host them all. I'll go create the projects in the next couple of days and ask google for an increase if there's not enough space.
I'd be glad to set you up with Trac/a VPS/etc. My company likes to support open-source development, and some of this could be quite useful.

We've got bandwidth, disk space, and CPU speed to spare.
ragnarok2040
Posts: 202
Joined: Wed Aug 09, 2006 1:00 am

Post by ragnarok2040 »

That's quite a nice offer, :D. I've already managed to get hosting at SourceForge, though. With my attention divided by so many projects, I wouldn't be able to actively maintain a server, heh. I'm hoping to push some stuff out in the next couple months so I'll have more free time to work on the toolchain.

Perhaps Chewi could take you up on the offer as he did the initial patches for gcc-4.3.2 and binutils-2.16.1 and was working on patches to get newer versions of Linux to boot on the PS2 as well.
cyt0plas
Posts: 2
Joined: Mon Jan 26, 2009 3:34 pm

Post by cyt0plas »

ragnarok2040 wrote:That's quite a nice offer, :D. I've already managed to get hosting at SourceForge, though. With my attention divided by so many projects, I wouldn't be able to actively maintain a server, heh. I'm hoping to push some stuff out in the next couple months so I'll have more free time to work on the toolchain.
SF works. Anyhow, the offer still stands, and I'm more than comfortable handling maintainance. It's not particularly difficult, nor time consuming when you have all the scripts, etc. to handle it already done :)

The main benefits above SF would be Git support, and speed. We have a very nice connection.
sonyman
Posts: 1
Joined: Sat Jul 11, 2009 12:07 pm

Post by sonyman »

I know this thread is old, but I wanted to know if any progress had been made or if there still is any interest in updating the toolchain and system libraries. I've had the Linux kit since launch and have messed around with it on and off since, but my interest is peaked again since I am now delving into the basics of programming in C.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

I was on and off about continuing it, now I'm pretty much off, unless as I've said before, some who REALLY knows this stuff steps up to help. I don't see that happening.
Post Reply