Subject: Re: gcc assembler issues
To: Collin Baillie <sanac@optushome.com.au>
From: Joel Reicher <joel@panacea.null.org>
List: port-pmax
Date: 06/29/2002 15:15:08
> Then when it got to the assembling stage, it failed with lots of "
> Error: Branch out of range" being printed to the console.
> 
> Anyway, I decided to check out the .s file, and see what I could find.
> 
> The first error message is:
> 
> /tmp/ccWjcZC2.s: Assembler messages:
> /tmp/ccWjcZC2.s:28764: Error: Branch out of range
> 
> Ok, so I've compled with the -S (instead of -c) option. And interpret.s
> works out the same. Line 28764 says this:
> 
>     j       $L3655

This is still a problem in 1.5.2 - I experienced it also. There are two
ways to fix it that I know of. Hack the assembler so that the above
says

la	$t0, $L3655
jr	$t0

where $t0 must be a register that is going to be overwritten before
used at the jump destination. If it isn't, pick another register.

The other way is to identify the function in the original source code
that is too large, and hack a source code solution for splitting
the function. Note this problem happens as a result of large functions,
not large files.

I've used both these fixes and they both work. The latter is much
easier if it's possible to find a way to do it, but the former has
the advantage of being simple to apply with some searching and
replacing.

Cheers,

	- Joel