Subject: Re: EGCS enabled on mips
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Todd Whitesel <firstname.lastname@example.org>
Date: 10/31/1998 20:47:44
> I dug into this some more. Looking at libbfd from binutils 2.8.1, the
> problem is that the mips ELF ABI requires HI16 relocs to be emitted as
> a pair with LO16 relocs, so that the linker can find the carry from
> relocating the low-order 16 bits and add it into the relocation of hte
> high-order 16 bits. Makes sense, really.
What if there was an alternative?
Add a third reloc called "hiadj" or "hi1" which looks at the low 16 bits of
the expression, and compensates for them. For example (pardon my asm, it's
been a while):
lui $1, %hi(expression)
ori $1, $1, %lo(expression)
lui $2, %hiadj(expression)
ld $2, $2, %lo(expression)
If the linker has enough info to know whether or not carry analysis is
required, then the pairing requirement isn't needed.
This reloc technique is already in use by toolchains from Green Hills,
GNU toolchains distributed through Wind River, and probably others.
toddpw @ best.com