[py-dev] error building greenlets

Armin Rigo arigo at tunes.org
Sat Aug 27 18:39:54 CEST 2005


Hi Alain,

On Wed, Aug 24, 2005 at 11:31:57PM +0200, Alain Poirier wrote:
> A code compiled with the -fPIC option must preserve the ebx register.

Indeed.

> So, if
> it's noted as "clobbered", the new versions of gcc emit an error.

This implication is not clear to me.  The goal of the "clobbered" is
precisely to force gcc to save the register to the stack and restore it.
The fact that newer versions of gcc doesn't like 'ebx' in the clobbered
list any more is an annoyance.

> A 'push ebx' / 'pop ebx' pair need to be added into the slp_switch function
> of switch_x86_unix.h 

Can you show the precise patch?  I guess that you have in mind a "push
ebx" in the first __asm__ line, and a "pop ebx" in the last one.  This
might be doing the trick but it looks very fragile (i.e. depending on
the exact way gcc generates code).

Now, I don't expect the value of the PIC register "ebx" to actually
change during the program execution, so that it will have the same value
in all greenlets at any time.  If so, we don't actually have to save and
restore it.  Just removing the "ebx" in the two clobbered lists should
be enough.

This is the conclusion to which I came some time ago already, but the
problem with it is to detect if the code is indeed being compiled with
-fPIC or not.  If not, the "ebx" in the clobbered is essential.  Any
clue?


A bientot,

Armin



More information about the Pytest-dev mailing list