This is the mail archive of the gcc@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: libgcc2.c troubles with volatile -- nope it's with PIC



  In message <9902141449.aa16529@paris.ics.uci.edu>you write:
  > Investigating further I am sure that it is something that the compiler
  > inserted on purpose at the beginning of the function: 
  >
  > On sparc-solaris libgcc2.c is compiled with -fPIC, in the assembler
  > output the mentioned "call" appears as:
  > 
  > call .LLGETPC0
  > 
  > where .LLGETPC0 is:
  > 
  > .LLGETPC0:
  >         retl
  >         add %o7,%l7,%l7
  > 
  > So this is just the PIC code. 
Right.  It's used to get the PC into a general register.  I had a feeling
this might be the case -- it's a pretty typical sequence on risc machines.


  > The problem is that this code changes the state of the processor (for
  > sure the psr register (the flags register on sparc)), and we cannot
  > save/restore if reliably using the the
  > MACHINE_STATE_SAVE/MACHINE_STATE_RESTORE macros.
Hmmm, what in the psr is changed in a visible way? 

  > What is the solution for this? 
Not sure.


  > I would say don't use -fPIC when compiling libgcc2.c to get _bb.o? 
  > (This is what I did on my local tree, and it's fine for my needs)
Probably not really feasible though.  For various reasons we need to be
able to compile all of libgcc with -fpic and -fPIC.

jeff


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