A modern GCC on IRIX 4

IRIX/Nekoware development, porting and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
hbent
Posts: 60
Joined: Fri Oct 24, 2003 3:24 pm
Location: Oberlin, OH
Contact:

A modern GCC on IRIX 4

Unread postby hbent » Wed Nov 07, 2012 5:27 pm

Has anyone looked into getting a modern version of GCC to run on IRIX 4? I have an Indigo running 4.0.5F and have toyed with builds on and off for a while, with little promise of success until recently.

The most recent version of GCC that will build successfully on IRIX 4 without modifications is GCC 3.0.4. 3.1 and 3.2 have problems with gcc/config/mips/mips.md, and after that the GCC folks dropped compatibility with older versions of IRIX. However I recently succeeded, with some source modifications, in building cross-compilers of 3.4.6 and 4.1.2 (x64 NetBSD host). Unfortunately I can't get 3.4.6 to build natively. The first major problem is a command line that exceeds NCARGS (only 10248!) but even after circumventing that problem I get internal GCC errors before the end of the build. I have not yet invested the time to try building 4.1.2 natively but will soon. And I thought gcc builds on my Octane2 were slow!

If anyone else is working on this or has any advice, I'd love to hear it. I bet this work could be leveraged to IRIX 3 too, they are very similar from GCC's perspective.

User avatar
jan-jaap
Donor
Donor
Posts: 4935
Joined: Thu Jun 17, 2004 11:35 am
Location: Wijchen, The Netherlands
Contact:

Re: A modern GCC on IRIX 4

Unread postby jan-jaap » Thu Nov 08, 2012 12:13 am

I've been building GCC on IRIX 3 a couple of years ago and the biggest problem is the pre-ANSI C library.

I put together a compatibility library to cover some of that and with that I could build GCC 3.0.4 on IRIX 3.3.
:PI: :Indigo: :Indigo: :Indy: :Indy: :Indy: :Indigo2: :Indigo2: :Indigo2IMP: :Octane: :Octane2: :O2: :O2+: Image :Fuel: :Tezro: :4D70G: :Skywriter: :PWRSeries: :Crimson: :ChallengeL: :Onyx: :O200: :Onyx2: :O3x02L:
To accentuate the special identity of the IRIS 4D/70, Silicon Graphics' designers selected a new color palette. The machine's coating blends dark grey, raspberry and beige colors into a pleasing harmony. (IRIS 4D/70 Superworkstation Technical Report)

oreissig
Posts: 91
Joined: Thu Jun 02, 2011 3:13 pm
Location: Germany
Contact:

Re: A modern GCC on IRIX 4

Unread postby oreissig » Thu Nov 08, 2012 9:47 am

I suppose you mean a R4k Indigo, or are you actually building 3.x gccs on an R3k? :)
hbent wrote:And I thought gcc builds on my Octane2 were slow!

I'm currently bootstrapping some 3.x gccs on a SPARCclassic :roll:

But nice project. I once build 3.4.6 for 5.3 (didn't go further because I was too lazy building gcc's dependencies), but didn't go down to 4 with gcc on my Indigo², yet.

User avatar
hbent
Posts: 60
Joined: Fri Oct 24, 2003 3:24 pm
Location: Oberlin, OH
Contact:

Re: A modern GCC on IRIX 4

Unread postby hbent » Thu Nov 08, 2012 9:58 am

I did mean an R4k Indigo, doing this on an R3k would be like watching paint dry. Though I did build 3.3.6 once on a Mac IIci running A/UX, as I recall it took well over 24 hours, probably very similar to working on a SPARCclassic.

My main motivation is to get to a version of GCC that knows about the R4000 errata. I'm hoping it will fix the coredumps I sometimes get when compiling software with -mips2.

User avatar
jan-jaap
Donor
Donor
Posts: 4935
Joined: Thu Jun 17, 2004 11:35 am
Location: Wijchen, The Netherlands
Contact:

Re: A modern GCC on IRIX 4

Unread postby jan-jaap » Fri Nov 09, 2012 12:15 am

Somewhere in the early GCC 3.x series it stopped working on R3K CPUs. I suspect someone used R4K instructions in the crtbegin/crtend assembly code.
hbent wrote:I did mean an R4k Indigo, doing this on an R3k would be like watching paint dry.

That, or you need something with *a lot* of R3000 CPU's, like a PowerSeries 'Predator' rack :D
:PI: :Indigo: :Indigo: :Indy: :Indy: :Indy: :Indigo2: :Indigo2: :Indigo2IMP: :Octane: :Octane2: :O2: :O2+: Image :Fuel: :Tezro: :4D70G: :Skywriter: :PWRSeries: :Crimson: :ChallengeL: :Onyx: :O200: :Onyx2: :O3x02L:
To accentuate the special identity of the IRIS 4D/70, Silicon Graphics' designers selected a new color palette. The machine's coating blends dark grey, raspberry and beige colors into a pleasing harmony. (IRIS 4D/70 Superworkstation Technical Report)

User avatar
miod
Posts: 522
Joined: Fri Oct 09, 2009 2:44 am
Location: Clermont-Ferrand (France)
Contact:

Re: A modern GCC on IRIX 4

Unread postby miod » Fri Nov 09, 2012 4:02 am

jan-jaap wrote:Somewhere in the early GCC 3.x series it stopped working on R3K CPUs. I suspect someone used R4K instructions in the crtbegin/crtend assembly code.

Aren't the various crt* files provided by the operating system? gcc does not provide such files.
:Indigo:R3000 (alas, dead) :Indigo:R4000 x4 :Indigo2:R4400 :Indigo2IMP:R4400 x2 :Indigo2:R8000 :Indigo2IMP:R10000 :Indy:R4000PC :Indy:R4000SC :Indy:R4400SC :Indy:R4600 :Indy:R5000SC :O2:R5000 x3 :O2:RM7000 :Octane:2xR10000 :Octane:R12000 :O200:2xR12000 :O200: - :O200:2x2xR10000 :Fuel:R16000 :O3x0:4xR16000 :A350:
among more than 150 machines : Apollo, Data General, Digital, HP, IBM, MIPS before SGI, Motorola, NeXT, SGI, Solbourne, Sun...

User avatar
jan-jaap
Donor
Donor
Posts: 4935
Joined: Thu Jun 17, 2004 11:35 am
Location: Wijchen, The Netherlands
Contact:

Re: A modern GCC on IRIX 4

Unread postby jan-jaap » Fri Nov 09, 2012 4:58 am

miod wrote:Aren't the various crt* files provided by the operating system? gcc does not provide such files.

GCC on IRIX provides crtbegin.o and crtend.o to deal with constructor/destructor stuff.

Edit: crtbegin/end are built from C code, but the mips specific code does contain two asm files. Or maybe the GCC code generator got borked, who knows.
:PI: :Indigo: :Indigo: :Indy: :Indy: :Indy: :Indigo2: :Indigo2: :Indigo2IMP: :Octane: :Octane2: :O2: :O2+: Image :Fuel: :Tezro: :4D70G: :Skywriter: :PWRSeries: :Crimson: :ChallengeL: :Onyx: :O200: :Onyx2: :O3x02L:
To accentuate the special identity of the IRIS 4D/70, Silicon Graphics' designers selected a new color palette. The machine's coating blends dark grey, raspberry and beige colors into a pleasing harmony. (IRIS 4D/70 Superworkstation Technical Report)

User avatar
miod
Posts: 522
Joined: Fri Oct 09, 2009 2:44 am
Location: Clermont-Ferrand (France)
Contact:

Re: A modern GCC on IRIX 4

Unread postby miod » Fri Nov 09, 2012 1:35 pm

jan-jaap wrote:
miod wrote:Aren't the various crt* files provided by the operating system? gcc does not provide such files.

GCC on IRIX provides crtbegin.o and crtend.o to deal with constructor/destructor stuff.

Ah, right, the joys of the collect2-as-an-ld-wrapper platforms.

jan-jaap wrote:Edit: crtbegin/end are built from C code, but the mips specific code does contain two asm files. Or maybe the GCC code generator got borked, who knows.

Well, the two .S files seem mips1-compatible to me. What may be wrong, OTOH, are the stack adjustments. The mips default frame size in gcc-produced code has changed several times over gcc development, and since almost noone tests gcc on IRIX < 5 those days, it is very likely that a stack frame size change has been applied everywhere but in gcc/config/mips/crt[in].asm...
:Indigo:R3000 (alas, dead) :Indigo:R4000 x4 :Indigo2:R4400 :Indigo2IMP:R4400 x2 :Indigo2:R8000 :Indigo2IMP:R10000 :Indy:R4000PC :Indy:R4000SC :Indy:R4400SC :Indy:R4600 :Indy:R5000SC :O2:R5000 x3 :O2:RM7000 :Octane:2xR10000 :Octane:R12000 :O200:2xR12000 :O200: - :O200:2x2xR10000 :Fuel:R16000 :O3x0:4xR16000 :A350:
among more than 150 machines : Apollo, Data General, Digital, HP, IBM, MIPS before SGI, Motorola, NeXT, SGI, Solbourne, Sun...

User avatar
hbent
Posts: 60
Joined: Fri Oct 24, 2003 3:24 pm
Location: Oberlin, OH
Contact:

Re: A modern GCC on IRIX 4

Unread postby hbent » Fri Nov 09, 2012 1:49 pm

miod wrote:Well, the two .S files seem mips1-compatible to me. What may be wrong, OTOH, are the stack adjustments. The mips default frame size in gcc-produced code has changed several times over gcc development, and since almost noone tests gcc on IRIX < 5 those days, it is very likely that a stack frame size change has been applied everywhere but in gcc/config/mips/crt[in].asm...


Frames are definitely my problem at the moment. The cross-compiler generates them correctly:

Code: Select all

         .frame  $fp,24,$31              # vars= 0, regs= 2/0, args= 16, gp= 0


but the native compiler is totally wacked:

Code: Select all

        .frame  $fp,12698368,(null)             # vars= 24, regs= 269896524/0, args= 0, gp= 0


I was working on the assumption that it was a problem with the compiler I was using to build gcc, and have switched to a different one for the run I'm doing now. Is there something else I should look into?

User avatar
miod
Posts: 522
Joined: Fri Oct 09, 2009 2:44 am
Location: Clermont-Ferrand (France)
Contact:

Re: A modern GCC on IRIX 4

Unread postby miod » Fri Nov 09, 2012 2:39 pm

hbent wrote:Frames are definitely my problem at the moment. The cross-compiler generates them correctly:

Code: Select all

         .frame  $fp,24,$31              # vars= 0, regs= 2/0, args= 16, gp= 0

but the native compiler is totally wacked:

Code: Select all

        .frame  $fp,12698368,(null)             # vars= 24, regs= 269896524/0, args= 0, gp= 0

I was working on the assumption that it was a problem with the compiler I was using to build gcc, and have switched to a different one for the run I'm doing now. Is there something else I should look into?

This smells like variadic functions (in that case, fprintf), are not working correctly. Are you sure your native compiler is built as an o32 binary (I'm not 100% sure anymore, but I doubt I am wrong assuming IRIX 4 uses the o32 ABI). Furthermore, if you're on an R4000 system, are you sure the native compiler isn't trying to output 64 bit code behind your back, or isn't built to expect an n64 world? An n32 vs o32 problem seems more likely so far, though.
:Indigo:R3000 (alas, dead) :Indigo:R4000 x4 :Indigo2:R4400 :Indigo2IMP:R4400 x2 :Indigo2:R8000 :Indigo2IMP:R10000 :Indy:R4000PC :Indy:R4000SC :Indy:R4400SC :Indy:R4600 :Indy:R5000SC :O2:R5000 x3 :O2:RM7000 :Octane:2xR10000 :Octane:R12000 :O200:2xR12000 :O200: - :O200:2x2xR10000 :Fuel:R16000 :O3x0:4xR16000 :A350:
among more than 150 machines : Apollo, Data General, Digital, HP, IBM, MIPS before SGI, Motorola, NeXT, SGI, Solbourne, Sun...

User avatar
foetz
Moderator
Moderator
Posts: 6590
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: A modern GCC on IRIX 4

Unread postby foetz » Mon Apr 20, 2015 2:41 am

miod wrote:I'm not 100% sure anymore, but I doubt I am wrong assuming IRIX 4 uses the o32 ABI).

i'm afraid you are. irix4 is coff.

or isn't built to expect an n64 world?

n64 was introduced with irix 6.0.

An n32 vs o32 problem seems more likely so far, though.

not so much, see above.


Return to “SGI: Development”

Who is online

Users browsing this forum: No registered users and 2 guests