Oops ! Really big problem with hermes sublibrary of SDL under QNX6

Hello, All!

Got a big problem yesterday, trying to enable MMX accelerated code under
QNX6. Hermes library isn’t a valid PIC code, so it’s usage in shared library
objects can cause continuous segmentation faults in different places
(including at initialization stage). Of course it depends on OS
architecture.

For example file mmxp2_32.asm: it contains the following line:

movq mm6, qword [mmx32_rgb888_mask]

which is wrong. According to NASM manual (check this section:
http://ivs.cs.uni-magdeburg.de/bs/lehre/sose99/bs1/nasm/nasmdoc8.html#section-8.2)
it must be:


call .get_GOT
.get_GOT: pop ebx
add ebx,GLOBAL_OFFSET_TABLE+$$-.get_GOT wrt …gotpc

otherwise it will fail ! QNX6 is very sensetive to this problems with PIC
code. One mistake and you’ll get SEGFAULT. Only static library works.

Maybe better to rewrite all this code via ‘asm’ includes in C modules ? Any
suggestions ?

Thanks !

With best regards, Mike Gorchak. E-mail: @Mike_Gorchak

Hello, Mike!

MG> Maybe better to rewrite all this code via ‘asm’ includes in C modules ?
MG> Any suggestions ?

Sorry, but anyone have any comments about described problems above ? Does
anyone have the similar problems ? Btw, I’ve found that ebx register was
destroyed in some of hermes’s assembly routines, which is not allowed in the
shared object modules, which also can cause many problems, while using it.

With best regards, Mike Gorchak. E-mail: @Mike_Gorchak

Hello, All!

Got a big problem yesterday, trying to enable MMX accelerated code under
QNX6. Hermes library isn’t a valid PIC code, so it’s usage in shared library
objects can cause continuous segmentation faults in different places
(including at initialization stage). Of course it depends on OS
architecture.

For example file mmxp2_32.asm: it contains the following line:

movq mm6, qword [mmx32_rgb888_mask]

which is wrong. According to NASM manual (check this section:
http://ivs.cs.uni-magdeburg.de/bs/lehre/sose99/bs1/nasm/nasmdoc8.html#section-8.2)
it must be:


call .get_GOT
.get_GOT: pop ebx
add ebx,GLOBAL_OFFSET_TABLE+$$-.get_GOT wrt …gotpc

otherwise it will fail ! QNX6 is very sensetive to this problems with PIC
code. One mistake and you’ll get SEGFAULT. Only static library works.

Can somebody submit a patch for this? I don’t have time to fix it myself.

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam Lantinga wrote:

otherwise it will fail ! QNX6 is very sensetive to this problems with PIC
code. One mistake and you’ll get SEGFAULT. Only static library works.

Can somebody submit a patch for this? I don’t have time to fix it myself.

I asked some days ago what was the prefered way to fix this :
http://libsdl.org/pipermail/sdl/2004-May/061451.html
I’d personnaly go for gcc inline asm.

Also, I think you missed that patch :
http://libsdl.org/pipermail/sdl/2004-May/061488.html

Stephane

Stephane Marchesin wrote:

Sam Lantinga wrote:

otherwise it will fail ! QNX6 is very sensetive to this problems
with PIC
code. One mistake and you’ll get SEGFAULT. Only static library works.

Can somebody submit a patch for this? I don’t have time to fix it
myself.

I asked some days ago what was the prefered way to fix this :
http://libsdl.org/pipermail/sdl/2004-May/061451.html
I’d personnaly go for gcc inline asm.

Ok, I take no answer as general consensus and will port the nasm code to
gcc inline asm in my next free time slice.

Stephane