[SDL] gcc-3.4.0 / PIC fix
stephane.marchesin at wanadoo.fr
Mon May 3 14:09:01 PDT 2004
Mike Frysinger wrote:
>On Monday 03 May 2004 04:08 pm, Stephane Marchesin wrote:
>>>this one claims ebx gets clobbered yet the asm saves/restores it ?
>>>removing it from the clobber list 'fixes' the problem since in reality it
>>>isn't clobbered ...
>>I don't like push/pops too much, but I see no other way. Using push/pop
>>means you have to be sure you can touch the stack which is not always
>>the case (for example with inlined functions).
>>>perhaps remove ebx from the clobber list and push/pop it in the same
>>>manner as SDL_yuv_mmx.c ?
>>We can simply remove ebx from the clobber list, since it's already saved
>mmm are we confusing SDL_cpuinfo.c and SDL_yuv_mmx.c ?
Hmmm... well let's be clear :
- no push/pops in the cpuinfo part (ebx is saved in edi)
- the yuv code is touchy wrt the register allocator (that varies greatly
among gcc versions), which tends to use all registers and thus we can't
spare ebx, so we can't avoid the push/pop
>the yuv_mmx code pushes/pops ebx so that bit can just trim the edx register
>from the clobber list, but the cpuinfo code doesnt ... it just calls cpuid
>which clobbers e[abcd]x ... and like you say, there doesnt seem to be any way
>around this other than using push/pops :/
In cpuinfo, ebx is saved in edi, so everything is fine.
>after rebuilding 1.2.7, SDL apps get angry with the _MMX_????? stuff:
>/usr/lib/libSDL.so: undefined reference to `_MMX_UbluRGB'
>/usr/lib/libSDL.so: undefined reference to `_MMX_Vred5x5'
>/usr/lib/libSDL.so: undefined reference to `_MMX_VgrnRGB'
>/usr/lib/libSDL.so: undefined reference to `_MMX_grn565'
>the patch below fixes up the asm code in SDL_yuv_mmx.c ... basically changes
>_MMX_VredRGB to %[_MMX_VredRGB] and adds [_MMX_VredRGB] "m" (*_MMX_VredRGB)
>definitions at the end ... havent had a chance to test it with gcc-3.3 though
Not sure that'll work on older gcc versions.
I'll look at it and send another patch (but probably not today, as I
need to test this on different gcc versions). Hopefully this will be the
More information about the SDL