This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libgcc2.c troubles with volatile -- nope it's with PIC
- To: Dan Nicolaescu <dann at godzilla dot ics dot uci dot edu>
- Subject: Re: libgcc2.c troubles with volatile -- nope it's with PIC
- From: Jeffrey A Law <law at hurl dot cygnus dot com>
- Date: Sun, 14 Feb 1999 19:00:24 -0700
- cc: egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
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