How to add 'relaxing' to loader for m68k

Alan Modra amodra@bigpond.net.au
Mon Apr 8 16:39:00 GMT 2002


On Mon, Apr 08, 2002 at 12:31:02PM -0400, Peter Barada wrote:
> 
> I'm looking at trying to shrink out some code space in the
> m68k/coldfire ports, and I'm noticing linked code that looks like:
> 
>      4fc:	4879 0000 5921 	pea 5921 <_foo+0x11>
>      502:	61ff 0000 11ca 	bsrl 16ce <puts>
>      508:	61ff 0000 2144 	bsrl 264e <breakpoint>
> 
> This could be changed to use word offsets for the bsr's:
[snip]
> And then the pea could be changed to use absolute short addressing:
[snip]
> 
> What's the best way to go about this?  Does the assembler create
> enough reloacation records to allow for proper relaxation (bsrl->bsrw
> relaxation between a conditional branch and its target, etc)?

You'll need to modify the asembler to emit relocs for code that is
normally fully resolved by the assembler, eg. branches to local
labels, because their offsets may change if intervening code is
relaxed.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list