"Relocation out-of-range" errors

David B. Anderson davea at quasar.wpd.sgi.com
Sun Oct 8 09:48:21 AEST 1989


In article <14188 at shamash.cdc.com> pwp at shamash.UUCP (Pete Poorman) writes:
>A few weeks back Steve Maurer asked what caused "jump relocation out of range"
>errors, and someone explained it.  
>
>Now, it's happening to me and the response has aged-away on my system.
>
>Can someone please explain again?  (I promise to save it this time!)

The question was answered by:

len at synthesis.Synthesis.COM (Len Lattanzi) in <28025 at mips.mips.COM>
;;Typically this is caused by one importing module referencing a symbol as text
;;and trying to jump to it. And the exporting module defining the symbol
;;to be data. Text and Data are normally too far apart to jump between.
;;You could use -Wl,-yerror,-yasm on the link command to indicate all
;;modules referencing error and asm and make sure the uses are consistent.

Len was exactly right.

Some further information:

A call to a named function is generated as a JAL instruction.

In the MIPS R2/3000 a JAL gets 26 bits for the address.   It is a word
address by definition, so  the 2 least significant bits are implicit.
Shifting the 26 bits from the instruction left two bits and making the top
4 bits identical to the address of the jump instruction itself gives a
target address.
	(Wouldn't a picture be better than words? :-)

In the ZMAGIC format (the format used for executables in IRIX) code starts
at 0x400000 and data starts at 0x10000000.

When one does a call (JAL) and the name is resolved to a _data address_ one
gets ``jump relocation out of range'' since the linker can see that the top
4 bits are not the same in the JAL instruction address and the target
address.

Regards,
[ David B. Anderson  Silicon Graphics  (415)335-1548  davea at sgi.com ]



More information about the Comp.sys.sgi mailing list