This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: PATCH: PIC_OFFSET_TABLE_REGNUM_SAVED should be call used when



  In message <Pine.LNX.4.21.0101151238510.21322-100000@front.linuxcare.com.au>y
ou write:
  > On Sun, 14 Jan 2001, John David Anglin wrote:
  > 
  > > > > > Oops, there is a problem.  The PIC_OFFSET_TABLE_REGNUM_SAVED regist
  > er
  > > > > > must be call used under all conditions since non PIC code has to be
  >  able
  > > > > > to call PIC code.
  > > > > 
  > > > > On further thought, the PIC_OFFSET_TABLE_REGNUM_SAVED can't be a call
  >  used
  > > > > register since this will break the run-time ABI.  I think this means 
  > that
  > > > > it can't be a fixed register as well.  Need a different solution.
  > > > 
  > > > Why will that break the ABI?  New code will just assume that r4 isn't
  > > > preserved over calls, but it's no problem if in fact r4 is preserved.  
  > It
  > > 
  > > If we make r4 call used, it isn't saved by the callee.
  > 
  > Hit's self on head.  Indeed.  Here's another curious little problem.
  > 
  > ---
  > extern void bar (void);
  > 
  > #define trash_r27 \
  >   do                                            \
  >     {                                           \
  >       register int x asm ("r27");               \
  >       asm volatile ("ldi 0,%0" : "=&r" (x) : "0" (x) ); \
  >     }                                           \
  >   while (0)
  > 
  > int main (void)
  > {
  >   trash_r27 (bar);
  >   bar ();
  >   return 0;
  > }
  > ---
  > 
  > With yesterday's sourceware CVS, hppa64-hpux11-gcc doesn't seem to see any
  > need to reload r27 for the call to bar.  This problem came to light when I
  > was investigating how to fix the calls which get pasted into _init (which
  > also don't reload r27, or r19 in 32 bit case, and so lose if there is more
  > than one pasted call).
Fixed registers must appear as call-clobbered (see the GCC documentation);
failure to do this will result in incorrect code.

jeff



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