[ppc] fix a couple of relax bugs

Nathan Sidwell nathan@codesourcery.com
Mon Aug 10 12:00:00 GMT 2009


This patch fixes two relax bugs

1) the existing relaxation trampolines use r11 to generate the target address. 
r11 is also used by the ABI to call the out-of-line register save and restore 
routines.  (And also for mcount).  These routines are exceptions to the regular 
ABI.  GCC can now emit calls to the ool save routines.  As you can guess, when 
relaxing an executable where the save routines are too far away from the 
prologue they are called from, things go badly wrong :(  AFAICT, r12 is an 
equally suitable temporary register, and is not used by such ABI exceptions.

2) I noticed the dire lack of testcases and added one.  This caused me to notice 
the other bug in the recent patch of mine that allowed relaxing a relocatable 
link.  We continued to use the target symbol's value to distinguish trampolines 
to different locations.  For a relocatable link with undefined symbols these are 
all going to be zero, resuling in a single trampoline.  oops!  Fixed by using 
the symbol's offset in the input symbol table in this case.  The reason I didn;t 
notice this originally is I was working with vxworks kernel modules.  these are 
relocatable links but are provided with the kernel symbol information and thus 
don't have any undefined symbols.

tested on powerpc-elf, ok?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery

-------------- next part --------------
A non-text attachment was scrubbed...
Name: relax.patch
Type: text/x-patch
Size: 7625 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20090810/43b2742a/attachment.bin>


More information about the Binutils mailing list