This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linker relocation problem



>        oscore.o powerline.o
>oscore.o: In function `mmuPpcDataTlbErrorHandler':
>oscore.o(.text+0xc8): relocation truncated to fit: R_PPC_REL14 _exit
>oscore.o(.text+0xd4): relocation truncated to fit: R_PPC_REL14 _exit
>oscore.o(.text+0xe0): relocation truncated to fit: R_PPC_REL14 _exit
>collect2: ld returned 1 exit status
>make: *** [powerline.elf] Error 1
>
>Can anybody explain the 'relocation truncated' errors?
>

Sure,

R_PPC_REL14 is the fixup mode assigned for instructions that contain a
PC relative address that is 14 bits long. I notice the following instructions:

>FUNC_START(mmuPpcDataTlbErrorHandler)
>	mtspr	799,r18
>	mfcr	r18
>	stw	r18,-4(sp)
>	mfdsisr	r18
>	rlwinm.	r18,r18,0,1,1
>	bne	FUNC_NAME(_exit)
>	mfdsisr	r18
>	rlwinm.	r18,r18,0,4,4
>	bne	FUNC_NAME(_exit)
>	mfdsisr	r18
>	rlwinm.	r18,r18,0,6,6
>	beq	FUNC_NAME(_exit)

And from the PPC book I see that bc instructions have a 14 bit PC
relative offset. Remember that this expands to 16 bits relative since
the lower two bits of the offset are assumed 0 to align the
instructions on a 4 byte boundary.

Check you link map, and you'll see that _exit is beyond 16 bits of address from
mmuPpcDataTblErrorHandler. That's the 'relocation truncated' error.

you'll have to juggle the assember to use a conditional branch over an
unconditional branch (which now gives you 26 bits of offset), or you
can load the address of _exit into the ctr register, and use the
branch conditional to the ctr register. 

-- 
Peter Barada                             pbarada@wavemark.com
Wizard
WaveMark Technologies, Inc.

"Real men know that you should never attempt to accomplish with words
what you can do with a flame thrower" --Bruce Ferstein
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]