summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-09-29 09:47:26 +0000
committerMike Frysinger <vapier@gentoo.org>2005-09-29 09:47:26 +0000
commit28b843b252124526e09b35383386c8ca5d14bc94 (patch)
treedf6c082211f5d4598346395a2207abecc66da9f4 /media-libs/libsdl/files
parentfixes the mistake of emulation in LDFLAGS. (diff)
downloadgentoo-2-28b843b252124526e09b35383386c8ca5d14bc94.tar.gz
gentoo-2-28b843b252124526e09b35383386c8ca5d14bc94.tar.bz2
gentoo-2-28b843b252124526e09b35383386c8ca5d14bc94.zip
Fix building with gcc-4 #104437, fixes for PIC issues from PaX team, and fix segfault in bomberclone #104533.
(Portage version: 2.0.52-r1 http://www.bash.org/?136501 )
Diffstat (limited to 'media-libs/libsdl/files')
-rw-r--r--media-libs/libsdl/files/digest-libsdl-1.2.9-r11
-rw-r--r--media-libs/libsdl/files/libsdl-1.2.9-PIC-SDL_stretch.patch16
-rw-r--r--media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-call-dont-jump.patch350
-rw-r--r--media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-cpuid.patch37
-rw-r--r--media-libs/libsdl/files/libsdl-1.2.9-PIC-load-mmx-masks-from-stack.patch166
-rw-r--r--media-libs/libsdl/files/libsdl-1.2.9-gcc-mmx.patch335
-rw-r--r--media-libs/libsdl/files/libsdl-1.2.9-no-exec-stack.patch44
-rw-r--r--media-libs/libsdl/files/libsdl-1.2.9-sdl-blit-mmx-check.patch15
8 files changed, 964 insertions, 0 deletions
diff --git a/media-libs/libsdl/files/digest-libsdl-1.2.9-r1 b/media-libs/libsdl/files/digest-libsdl-1.2.9-r1
new file mode 100644
index 000000000000..c3c1f27988af
--- /dev/null
+++ b/media-libs/libsdl/files/digest-libsdl-1.2.9-r1
@@ -0,0 +1 @@
+MD5 80919ef556425ff82a8555ff40a579a0 SDL-1.2.9.tar.gz 2688179
diff --git a/media-libs/libsdl/files/libsdl-1.2.9-PIC-SDL_stretch.patch b/media-libs/libsdl/files/libsdl-1.2.9-PIC-SDL_stretch.patch
new file mode 100644
index 000000000000..bff711205ff6
--- /dev/null
+++ b/media-libs/libsdl/files/libsdl-1.2.9-PIC-SDL_stretch.patch
@@ -0,0 +1,16 @@
+Kill off TEXTREL in SDL_SoftStretch()
+
+--- src/video/SDL_stretch.c
++++ src/video/SDL_stretch.c
+@@ -286,9 +286,9 @@ int SDL_SoftStretch(SDL_Surface *src, SD
+ default:
+ #ifdef __GNUC__
+ __asm__ __volatile__ (
+- "call _copy_row"
++ "call *%4"
+ : "=&D" (u1), "=&S" (u2)
+- : "0" (dstp), "1" (srcp)
++ : "0" (dstp), "1" (srcp), "r" (&_copy_row)
+ : "memory" );
+ #else
+ #ifdef WIN32
diff --git a/media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-call-dont-jump.patch b/media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-call-dont-jump.patch
new file mode 100644
index 000000000000..6dc9aef38edf
--- /dev/null
+++ b/media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-call-dont-jump.patch
@@ -0,0 +1,350 @@
+Fixes from PaX team to eliminate TEXTRELs in hermes code
+
+--- src/hermes/mmx_main.asm
++++ src/hermes/mmx_main.asm
+@@ -10,7 +10,6 @@
+ BITS 32
+
+ GLOBAL _ConvertMMX
+-GLOBAL _mmxreturn
+
+
+ SECTION .text
+@@ -50,9 +49,8 @@ _ConvertMMX:
+ y_loop:
+ mov ecx,[ebp+4]
+
+- jmp [ebp+32]
++ call [ebp+32]
+
+-_mmxreturn:
+ add esi,[ebp+12]
+ add edi,[ebp+28]
+
+--- src/hermes/x86_main.asm
++++ src/hermes/x86_main.asm
+@@ -12,7 +12,6 @@
+ BITS 32
+
+ GLOBAL _ConvertX86
+-GLOBAL _x86return
+
+ GLOBAL _Hermes_X86_CPU
+
+@@ -54,9 +53,8 @@
+ y_loop:
+ mov ecx,[ebp+4]
+
+- jmp [ebp+32]
++ call [ebp+32]
+
+-_x86return:
+ add esi,[ebp+12]
+ add edi,[ebp+28]
+
+--- src/hermes/x86p_16.asm
++++ src/hermes/x86p_16.asm
+@@ -25,7 +25,6 @@ GLOBAL _ConvertX86p16_16BGR555
+ GLOBAL _ConvertX86p16_8RGB332
+
+ EXTERN _ConvertX86
+-EXTERN _x86return
+
+
+ SECTION .text
+@@ -57,7 +56,7 @@ _ConvertX86p16_16BGR565:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov eax,edi
+@@ -135,7 +134,7 @@ _ConvertX86p16_16BGR565:
+ add edi,BYTE 2
+
+ .L7
+- jmp _x86return
++ retn
+
+
+
+@@ -164,7 +163,7 @@ _ConvertX86p16_16RGB555:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov eax,edi
+@@ -243,7 +242,7 @@ _ConvertX86p16_16RGB555:
+ jmp SHORT .L6
+
+ .L7 pop ebp
+- jmp _x86return
++ retn
+
+
+
+@@ -277,7 +276,7 @@ _ConvertX86p16_16BGR555:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov eax,edi
+@@ -361,7 +360,7 @@ _ConvertX86p16_16BGR555:
+ add edi,BYTE 2
+
+ .L7
+- jmp _x86return
++ retn
+
+
+
+@@ -394,7 +393,7 @@ _ConvertX86p16_8RGB332:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 mov eax,edi
+ and eax,BYTE 11b
+@@ -492,5 +491,5 @@ _ConvertX86p16_8RGB332:
+ jnz .L6
+
+ .L7 pop ebp
+- jmp _x86return
++ retn
+
+--- src/hermes/x86p_32.asm
++++ src/hermes/x86p_32.asm
+@@ -23,8 +23,7 @@ GLOBAL _ConvertX86p32_16RGB555
+ GLOBAL _ConvertX86p32_16BGR555
+ GLOBAL _ConvertX86p32_8RGB332
+
+-EXTERN _x86return
+-
++
+ SECTION .text
+
+
+@@ -53,7 +52,7 @@ _ConvertX86p32_32BGR888:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; save ebp
+ push ebp
+@@ -113,7 +112,7 @@ _ConvertX86p32_32BGR888:
+ jnz .L5
+
+ .L6 pop ebp
+- jmp _x86return
++ retn
+
+
+
+@@ -133,7 +132,7 @@ _ConvertX86p32_32RGBA888:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; save ebp
+ push ebp
+@@ -184,7 +183,7 @@ _ConvertX86p32_32RGBA888:
+ jnz .L5
+
+ .L6 pop ebp
+- jmp _x86return
++ retn
+
+
+
+@@ -204,7 +203,7 @@ _ConvertX86p32_32BGRA888:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; save ebp
+ push ebp
+@@ -257,7 +256,7 @@ _ConvertX86p32_32BGRA888:
+ jnz .L5
+
+ .L6 pop ebp
+- jmp _x86return
++ retn
+
+
+
+@@ -282,7 +281,7 @@ _ConvertX86p32_24RGB888:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov edx,edi
+@@ -354,7 +353,7 @@ _ConvertX86p32_24RGB888:
+ jnz .L6
+
+ .L7 pop ebp
+- jmp _x86return
++ retn
+
+
+
+@@ -380,7 +379,7 @@ _ConvertX86p32_24BGR888:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov edx,edi
+@@ -455,7 +454,7 @@ _ConvertX86p32_24BGR888:
+
+ .L7
+ pop ebp
+- jmp _x86return
++ retn
+
+
+
+@@ -484,7 +483,7 @@ _ConvertX86p32_16RGB565:
+ jnz .L1
+
+ .L2: ; End of short loop
+- jmp _x86return
++ retn
+
+
+ .L3 ; head
+@@ -570,7 +569,7 @@ _ConvertX86p32_16RGB565:
+ add edi,BYTE 2
+
+ .L7:
+- jmp _x86return
++ retn
+
+
+
+@@ -599,7 +598,7 @@ _ConvertX86p32_16BGR565:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov ebx,edi
+@@ -684,7 +683,7 @@ _ConvertX86p32_16BGR565:
+ add edi,BYTE 2
+
+ .L7
+- jmp _x86return
++ retn
+
+
+
+@@ -713,7 +712,7 @@ _ConvertX86p32_16RGB555:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov ebx,edi
+@@ -795,7 +794,7 @@ _ConvertX86p32_16RGB555:
+ add edi,BYTE 2
+
+ .L7
+- jmp _x86return
++ retn
+
+
+
+@@ -825,7 +824,7 @@ _ConvertX86p32_16BGR555:
+ dec ecx
+ jnz .L1
+ .L2
+- jmp _x86return
++ retn
+
+ .L3 ; head
+ mov ebx,edi
+@@ -910,7 +909,7 @@ _ConvertX86p32_16BGR555:
+ add edi,BYTE 2
+
+ .L7
+- jmp _x86return
++ retn
+
+
+
+@@ -1040,5 +1039,5 @@ _ConvertX86p32_8RGB332:
+ jnz .L3
+
+ .L4:
+- jmp _x86return
++ retn
+
+--- src/hermes/mmxp2_32.asm
++++ src/hermes/mmxp2_32.asm
+@@ -27,8 +27,6 @@ GLOBAL _ConvertMMXpII32_16BGR565
+ GLOBAL _ConvertMMXpII32_16RGB555
+ GLOBAL _ConvertMMXpII32_16BGR555
+
+-EXTERN _mmxreturn
+-
+ SECTION .data
+
+ ALIGN 8
+@@ -108,7 +98,7 @@ _ConvertMMXpII32_24RGB888:
+ dec ecx
+ jnz .L3
+ .L4:
+- jmp _mmxreturn
++ return
+
+
+
+@@ -176,7 +173,7 @@ _ConvertMMXpII32_16RGB565:
+ jnz .L3
+
+ .L4:
+- jmp _mmxreturn
++ retn
+
+
+ _ConvertMMXpII32_16BGR565:
+@@ -245,7 +249,7 @@ _ConvertMMXpII32_16BGR565:
+ jnz .L3
+
+ .L4:
+- jmp _mmxreturn
++ retn
+
+ _ConvertMMXpII32_16BGR555:
+
+@@ -380,5 +384,5 @@ _convert_bgr555_cheat:
+ jnz .L3
+
+ .L4:
+- jmp _mmxreturn
++ retn
+
diff --git a/media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-cpuid.patch b/media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-cpuid.patch
new file mode 100644
index 000000000000..d7794881ddeb
--- /dev/null
+++ b/media-libs/libsdl/files/libsdl-1.2.9-PIC-hermes-cpuid.patch
@@ -0,0 +1,37 @@
+Fixes from the PaX team to eliminate TEXTRELs
+
+--- src/hermes/x86_main.asm
++++ src/hermes/x86_main.asm
+@@ -17,11 +17,6 @@ GLOBAL _x86return
+ GLOBAL _Hermes_X86_CPU
+
+
+-SECTION .data
+-
+-cpu_flags dd 0
+-
+-
+ SECTION .text
+
+ ;; _ConvertX86:
+@@ -110,16 +105,13 @@ _Hermes_X86_CPU:
+ xor eax,ecx
+ je .L1
+
+- pusha
+-
++ push ebx
++
+ mov eax,1
+ cpuid
++ mov eax,edx
+
+- mov [cpu_flags],edx
+-
+- popa
+-
+- mov eax,[cpu_flags]
++ pop ebx
+
+ .L1:
+ ret
diff --git a/media-libs/libsdl/files/libsdl-1.2.9-PIC-load-mmx-masks-from-stack.patch b/media-libs/libsdl/files/libsdl-1.2.9-PIC-load-mmx-masks-from-stack.patch
new file mode 100644
index 000000000000..961730114973
--- /dev/null
+++ b/media-libs/libsdl/files/libsdl-1.2.9-PIC-load-mmx-masks-from-stack.patch
@@ -0,0 +1,166 @@
+--- src/hermes/mmxp2_32.asm
++++ src/hermes/mmxp2_32.asm
+@@ -27,22 +27,37 @@ GLOBAL _ConvertMMXpII32_16BGR565
+ GLOBAL _ConvertMMXpII32_16RGB555
+ GLOBAL _ConvertMMXpII32_16BGR555
+
+-SECTION .data
+-
+-ALIGN 8
+-
+-;; Constants for conversion routines
+-
+-mmx32_rgb888_mask dd 00ffffffh,00ffffffh
+-
+-mmx32_rgb565_b dd 000000f8h, 000000f8h
+-mmx32_rgb565_g dd 0000fc00h, 0000fc00h
+-mmx32_rgb565_r dd 00f80000h, 00f80000h
+-
+-mmx32_rgb555_rb dd 00f800f8h,00f800f8h
+-mmx32_rgb555_g dd 0000f800h,0000f800h
+-mmx32_rgb555_mul dd 20000008h,20000008h
+-mmx32_bgr555_mul dd 00082000h,00082000h
++
++;; Macros for conversion routines
++
++%macro _push_immq_mask 1
++ push dword %1
++ push dword %1
++%endmacro
++
++%macro load_immq 2
++ _push_immq_mask %2
++ movq %1, [esp]
++%endmacro
++
++%macro pand_immq 2
++ _push_immq_mask %2
++ pand %1, [esp]
++%endmacro
++
++%define CLEANUP_IMMQ_LOADS(num) \
++ add esp, byte 8 * num
++
++%define mmx32_rgb888_mask 00ffffffh
++
++%define mmx32_rgb565_b 000000f8h
++%define mmx32_rgb565_g 0000fc00h
++%define mmx32_rgb565_r 00f80000h
++
++%define mmx32_rgb555_rb 00f800f8h
++%define mmx32_rgb555_g 0000f800h
++%define mmx32_rgb555_mul 20000008h
++%define mmx32_bgr555_mul 00082000h
+
+
+
+@@ -53,7 +66,8 @@ SECTION .text
+ _ConvertMMXpII32_24RGB888:
+
+ ; set up mm6 as the mask, mm7 as zero
+- movq mm6, qword [mmx32_rgb888_mask]
++ load_immq mm6, mmx32_rgb888_mask
++ CLEANUP_IMMQ_LOADS(1)
+ pxor mm7, mm7
+
+ mov edx, ecx ; save ecx
+@@ -108,9 +122,10 @@ _ConvertMMXpII32_24RGB888:
+ _ConvertMMXpII32_16RGB565:
+
+ ; set up masks
+- movq mm5, [mmx32_rgb565_b]
+- movq mm6, [mmx32_rgb565_g]
+- movq mm7, [mmx32_rgb565_r]
++ load_immq mm5, mmx32_rgb565_b
++ load_immq mm6, mmx32_rgb565_g
++ load_immq mm7, mmx32_rgb565_r
++ CLEANUP_IMMQ_LOADS(3)
+
+ mov edx, ecx
+ shr ecx, 2
+@@ -176,9 +191,10 @@ _ConvertMMXpII32_16RGB565:
+
+ _ConvertMMXpII32_16BGR565:
+
+- movq mm5, [mmx32_rgb565_r]
+- movq mm6, [mmx32_rgb565_g]
+- movq mm7, [mmx32_rgb565_b]
++ load_immq mm5, mmx32_rgb565_r
++ load_immq mm6, mmx32_rgb565_g
++ load_immq mm7, mmx32_rgb565_b
++ CLEANUP_IMMQ_LOADS(3)
+
+ mov edx, ecx
+ shr ecx, 2
+@@ -253,7 +269,7 @@ _ConvertMMXpII32_16BGR555:
+ ; except it uses a different multiplier for the pmaddwd
+ ; instruction. cool huh.
+
+- movq mm7, qword [mmx32_bgr555_mul]
++ load_immq mm7, mmx32_bgr555_mul
+ jmp _convert_bgr555_cheat
+
+ ; This is the same as the Intel version.. they obviously went to
+@@ -263,9 +279,10 @@ _ConvertMMXpII32_16BGR555:
+ ; (I think) a more accurate name..
+ _ConvertMMXpII32_16RGB555:
+
+- movq mm7,qword [mmx32_rgb555_mul]
++ load_immq mm7, mmx32_rgb555_mul
+ _convert_bgr555_cheat:
+- movq mm6,qword [mmx32_rgb555_g]
++ load_immq mm6, mmx32_rgb555_g
++ CLEANUP_IMMQ_LOADS(2)
+
+ mov edx,ecx ; Save ecx
+
+@@ -280,12 +297,14 @@ _convert_bgr555_cheat:
+ movq mm0,[esi]
+ movq mm3,mm2
+
+- pand mm3,qword [mmx32_rgb555_rb]
++ pand_immq mm3, mmx32_rgb555_rb
+ movq mm1,mm0
+
+- pand mm1,qword [mmx32_rgb555_rb]
++ pand_immq mm1, mmx32_rgb555_rb
+ pmaddwd mm3,mm7
+
++ CLEANUP_IMMQ_LOADS(2)
++
+ pmaddwd mm1,mm7
+ pand mm2,mm6
+
+@@ -302,13 +321,13 @@ _convert_bgr555_cheat:
+ movq mm0,mm4
+ psrld mm1,6
+
+- pand mm0,qword [mmx32_rgb555_rb]
++ pand_immq mm0, mmx32_rgb555_rb
+ packssdw mm1,mm3
+
+ movq mm3,mm5
+ pmaddwd mm0,mm7
+
+- pand mm3,qword [mmx32_rgb555_rb]
++ pand_immq mm3, mmx32_rgb555_rb
+ pand mm4,mm6
+
+ movq [edi],mm1
+@@ -329,12 +348,14 @@ _convert_bgr555_cheat:
+ movq mm3,mm2
+ movq mm1,mm0
+
+- pand mm3,qword [mmx32_rgb555_rb]
++ pand_immq mm3, mmx32_rgb555_rb
+ packssdw mm5,mm4
+
+- pand mm1,qword [mmx32_rgb555_rb]
++ pand_immq mm1, mmx32_rgb555_rb
+ pand mm2,mm6
+
++ CLEANUP_IMMQ_LOADS(4)
++
+ movq [edi+8],mm5
+ pmaddwd mm3,mm7
+
diff --git a/media-libs/libsdl/files/libsdl-1.2.9-gcc-mmx.patch b/media-libs/libsdl/files/libsdl-1.2.9-gcc-mmx.patch
new file mode 100644
index 000000000000..2926577e2b75
--- /dev/null
+++ b/media-libs/libsdl/files/libsdl-1.2.9-gcc-mmx.patch
@@ -0,0 +1,335 @@
+http://bugs.gentoo.org/104437
+
+get this mmx stuff to build with gcc2/gcc3/gcc4
+
+Index: src/video/SDL_yuv_mmx.c
+===================================================================
+RCS file: /home/sdlweb/libsdl.org/cvs/SDL12/src/video/SDL_yuv_mmx.c,v
+retrieving revision 1.9
+retrieving revision 1.10
+diff -u -p -r1.9 -r1.10
+--- src/video/SDL_yuv_mmx.c 13 Feb 2005 07:10:02 -0000 1.9
++++ src/video/SDL_yuv_mmx.c 28 Sep 2005 02:26:29 -0000 1.10
+@@ -30,42 +30,31 @@ static char rcsid =
+
+ #include "SDL_types.h"
+
+-#if __GNUC__ > 2
+-# undef GCC2_HACK
+-#else
+-# define GCC2_HACK
+-#endif
+-
+-
+-#if defined(GCC2_HACK) && defined (__ELF__)
+-#define ASM_VAR(X) _##X
+-#else
+-#define ASM_VAR(X) X
+-#endif
++#define ASM_ARRAY(x) x[] __asm__("_" #x) __attribute__((used))
+
+-static volatile unsigned int ASM_VAR(MMX_0080w)[] = {0x00800080, 0x00800080};
+-static volatile unsigned int ASM_VAR(MMX_00FFw)[] = {0x00ff00ff, 0x00ff00ff};
+-static volatile unsigned int ASM_VAR(MMX_FF00w)[] = {0xff00ff00, 0xff00ff00};
+-
+-static volatile unsigned short ASM_VAR(MMX_Ycoeff)[] = {0x004a, 0x004a, 0x004a, 0x004a};
+-
+-static volatile unsigned short ASM_VAR(MMX_UbluRGB)[] = {0x0072, 0x0072, 0x0072, 0x0072};
+-static volatile unsigned short ASM_VAR(MMX_VredRGB)[] = {0x0059, 0x0059, 0x0059, 0x0059};
+-static volatile unsigned short ASM_VAR(MMX_UgrnRGB)[] = {0xffea, 0xffea, 0xffea, 0xffea};
+-static volatile unsigned short ASM_VAR(MMX_VgrnRGB)[] = {0xffd2, 0xffd2, 0xffd2, 0xffd2};
+-
+-static volatile unsigned short ASM_VAR(MMX_Ublu5x5)[] = {0x0081, 0x0081, 0x0081, 0x0081};
+-static volatile unsigned short ASM_VAR(MMX_Vred5x5)[] = {0x0066, 0x0066, 0x0066, 0x0066};
+-static volatile unsigned short ASM_VAR(MMX_Ugrn555)[] = {0xffe7, 0xffe7, 0xffe7, 0xffe7};
+-static volatile unsigned short ASM_VAR(MMX_Vgrn555)[] = {0xffcc, 0xffcc, 0xffcc, 0xffcc};
+-static volatile unsigned short ASM_VAR(MMX_Ugrn565)[] = {0xffe8, 0xffe8, 0xffe8, 0xffe8};
+-static volatile unsigned short ASM_VAR(MMX_Vgrn565)[] = {0xffcd, 0xffcd, 0xffcd, 0xffcd};
+-
+-static volatile unsigned short ASM_VAR(MMX_red555)[] = {0x7c00, 0x7c00, 0x7c00, 0x7c00};
+-static volatile unsigned short ASM_VAR(MMX_red565)[] = {0xf800, 0xf800, 0xf800, 0xf800};
+-static volatile unsigned short ASM_VAR(MMX_grn555)[] = {0x03e0, 0x03e0, 0x03e0, 0x03e0};
+-static volatile unsigned short ASM_VAR(MMX_grn565)[] = {0x07e0, 0x07e0, 0x07e0, 0x07e0};
+-static volatile unsigned short ASM_VAR(MMX_blu5x5)[] = {0x001f, 0x001f, 0x001f, 0x001f};
++static unsigned int ASM_ARRAY(MMX_0080w) = {0x00800080, 0x00800080};
++static unsigned int ASM_ARRAY(MMX_00FFw) = {0x00ff00ff, 0x00ff00ff};
++static unsigned int ASM_ARRAY(MMX_FF00w) = {0xff00ff00, 0xff00ff00};
++
++static unsigned short ASM_ARRAY(MMX_Ycoeff) = {0x004a, 0x004a, 0x004a, 0x004a};
++
++static unsigned short ASM_ARRAY(MMX_UbluRGB) = {0x0072, 0x0072, 0x0072, 0x0072};
++static unsigned short ASM_ARRAY(MMX_VredRGB) = {0x0059, 0x0059, 0x0059, 0x0059};
++static unsigned short ASM_ARRAY(MMX_UgrnRGB) = {0xffea, 0xffea, 0xffea, 0xffea};
++static unsigned short ASM_ARRAY(MMX_VgrnRGB) = {0xffd2, 0xffd2, 0xffd2, 0xffd2};
++
++static unsigned short ASM_ARRAY(MMX_Ublu5x5) = {0x0081, 0x0081, 0x0081, 0x0081};
++static unsigned short ASM_ARRAY(MMX_Vred5x5) = {0x0066, 0x0066, 0x0066, 0x0066};
++static unsigned short ASM_ARRAY(MMX_Ugrn555) = {0xffe7, 0xffe7, 0xffe7, 0xffe7};
++static unsigned short ASM_ARRAY(MMX_Vgrn555) = {0xffcc, 0xffcc, 0xffcc, 0xffcc};
++static unsigned short ASM_ARRAY(MMX_Ugrn565) = {0xffe8, 0xffe8, 0xffe8, 0xffe8};
++static unsigned short ASM_ARRAY(MMX_Vgrn565) = {0xffcd, 0xffcd, 0xffcd, 0xffcd};
++
++static unsigned short ASM_ARRAY(MMX_red555) = {0x7c00, 0x7c00, 0x7c00, 0x7c00};
++static unsigned short ASM_ARRAY(MMX_red565) = {0xf800, 0xf800, 0xf800, 0xf800};
++static unsigned short ASM_ARRAY(MMX_grn555) = {0x03e0, 0x03e0, 0x03e0, 0x03e0};
++static unsigned short ASM_ARRAY(MMX_grn565) = {0x07e0, 0x07e0, 0x07e0, 0x07e0};
++static unsigned short ASM_ARRAY(MMX_blu5x5) = {0x001f, 0x001f, 0x001f, 0x001f};
+
+ /**
+ This MMX assembler is my first assembler/MMX program ever.
+@@ -127,21 +116,12 @@ void ColorRGBDitherYV12MMX1X( int *color
+ "movd (%2), %%mm2\n" // 0 0 0 0 l3 l2 l1 l0
+ "punpcklbw %%mm7,%%mm1\n" // 0 v3 0 v2 00 v1 00 v0
+ "punpckldq %%mm1,%%mm1\n" // 00 v1 00 v0 00 v1 00 v0
+-#ifdef GCC2_HACK
+ "psubw _MMX_0080w,%%mm1\n" // mm1-128:r1 r1 r0 r0 r1 r1 r0 r0
+-#else
+- "psubw %[_MMX_0080w],%%mm1\n" // mm1-128:r1 r1 r0 r0 r1 r1 r0 r0
+-#endif
+
+ // create Cr_g (result in mm0)
+ "movq %%mm1,%%mm0\n" // r1 r1 r0 r0 r1 r1 r0 r0
+-#ifdef GCC2_HACK
+ "pmullw _MMX_VgrnRGB,%%mm0\n"// red*-46dec=0.7136*64
+ "pmullw _MMX_VredRGB,%%mm1\n"// red*89dec=1.4013*64
+-#else
+- "pmullw %[_MMX_VgrnRGB],%%mm0\n"// red*-46dec=0.7136*64
+- "pmullw %[_MMX_VredRGB],%%mm1\n"// red*89dec=1.4013*64
+-#endif
+ "psraw $6, %%mm0\n" // red=red/64
+ "psraw $6, %%mm1\n" // red=red/64
+
+@@ -150,13 +130,8 @@ void ColorRGBDitherYV12MMX1X( int *color
+ "movq (%2,%4),%%mm3\n" // 0 0 0 0 L3 L2 L1 L0
+ "punpckldq %%mm3,%%mm2\n" // L3 L2 L1 L0 l3 l2 l1 l0
+ "movq %%mm2,%%mm4\n" // L3 L2 L1 L0 l3 l2 l1 l0
+-#ifdef GCC2_HACK
+ "pand _MMX_FF00w,%%mm2\n" // L3 0 L1 0 l3 0 l1 0
+ "pand _MMX_00FFw,%%mm4\n" // 0 L2 0 L0 0 l2 0 l0
+-#else
+- "pand %[_MMX_FF00w],%%mm2\n" // L3 0 L1 0 l3 0 l1 0
+- "pand %[_MMX_00FFw],%%mm4\n" // 0 L2 0 L0 0 l2 0 l0
+-#endif
+ "psrlw $8,%%mm2\n" // 0 L3 0 L1 0 l3 0 l1
+
+ // create R (result in mm6)
+@@ -173,20 +148,11 @@ void ColorRGBDitherYV12MMX1X( int *color
+ "movd (%1), %%mm1\n" // 0 0 0 0 u3 u2 u1 u0
+ "punpcklbw %%mm7,%%mm1\n" // 0 u3 0 u2 00 u1 00 u0
+ "punpckldq %%mm1,%%mm1\n" // 00 u1 00 u0 00 u1 00 u0
+-#ifdef GCC2_HACK
+ "psubw _MMX_0080w,%%mm1\n" // mm1-128:u1 u1 u0 u0 u1 u1 u0 u0
+-#else
+- "psubw %[_MMX_0080w],%%mm1\n" // mm1-128:u1 u1 u0 u0 u1 u1 u0 u0
+-#endif
+ // create Cb_g (result in mm5)
+ "movq %%mm1,%%mm5\n" // u1 u1 u0 u0 u1 u1 u0 u0
+-#ifdef GCC2_HACK
+ "pmullw _MMX_UgrnRGB,%%mm5\n" // blue*-109dec=1.7129*64
+ "pmullw _MMX_UbluRGB,%%mm1\n" // blue*114dec=1.78125*64
+-#else
+- "pmullw %[_MMX_UgrnRGB],%%mm5\n" // blue*-109dec=1.7129*64
+- "pmullw %[_MMX_UbluRGB],%%mm1\n" // blue*114dec=1.78125*64
+-#endif
+ "psraw $6, %%mm5\n" // blue=red/64
+ "psraw $6, %%mm1\n" // blue=blue/64
+
+@@ -268,17 +234,7 @@ void ColorRGBDitherYV12MMX1X( int *color
+ "popl %%ebx\n"
+ :
+ : "m" (cr), "r"(cb),"r"(lum),
+- "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod)
+-#ifndef GCC2_HACK
+- ,[_MMX_0080w] "m" (*MMX_0080w),
+- [_MMX_00FFw] "m" (*MMX_00FFw),
+- [_MMX_FF00w] "m" (*MMX_FF00w),
+- [_MMX_VgrnRGB] "m" (*MMX_VgrnRGB),
+- [_MMX_VredRGB] "m" (*MMX_VredRGB),
+- [_MMX_UgrnRGB] "m" (*MMX_UgrnRGB),
+- [_MMX_UbluRGB] "m" (*MMX_UbluRGB)
+-#endif
+- );
++ "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod));
+ }
+
+ void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
+@@ -307,48 +263,21 @@ void Color565DitherYV12MMX1X( int *color
+ "movd (%%ebx), %%mm1\n" // 4 Cr 0 0 0 0 v3 v2 v1 v0
+ "punpcklbw %%mm7, %%mm0\n" // 4 W cb 0 u3 0 u2 0 u1 0 u0
+ "punpcklbw %%mm7, %%mm1\n" // 4 W cr 0 v3 0 v2 0 v1 0 v0
+-#ifdef GCC2_HACK
+ "psubw _MMX_0080w, %%mm0\n"
+ "psubw _MMX_0080w, %%mm1\n"
+-#else
+- "psubw %[_MMX_0080w], %%mm0\n"
+- "psubw %[_MMX_0080w], %%mm1\n"
+-#endif
+ "movq %%mm0, %%mm2\n" // Cb 0 u3 0 u2 0 u1 0 u0
+ "movq %%mm1, %%mm3\n" // Cr
+-#ifdef GCC2_HACK
+ "pmullw _MMX_Ugrn565, %%mm2\n" // Cb2green 0 R3 0 R2 0 R1 0 R0
+-#else
+- "pmullw %[_MMX_Ugrn565], %%mm2\n" // Cb2green 0 R3 0 R2 0 R1 0 R0
+-#endif
+ "movq (%2), %%mm6\n" // L1 l7 L6 L5 L4 L3 L2 L1 L0
+-#ifdef GCC2_HACK
+ "pmullw _MMX_Ublu5x5, %%mm0\n" // Cb2blue
+ "pand _MMX_00FFw, %%mm6\n" // L1 00 L6 00 L4 00 L2 00 L0
+ "pmullw _MMX_Vgrn565, %%mm3\n" // Cr2green
+-#else
+- "pmullw %[_MMX_Ublu5x5], %%mm0\n" // Cb2blue
+- "pand %[_MMX_00FFw], %%mm6\n" // L1 00 L6 00 L4 00 L2 00 L0
+- "pmullw %[_MMX_Vgrn565], %%mm3\n" // Cr2green
+-#endif
+ "movq (%2), %%mm7\n" // L2
+-#ifdef GCC2_HACK
+ "pmullw _MMX_Vred5x5, %%mm1\n" // Cr2red
+-#else
+- "pmullw %[_MMX_Vred5x5], %%mm1\n" // Cr2red
+-#endif
+ "psrlw $8, %%mm7\n" // L2 00 L7 00 L5 00 L3 00 L1
+-#ifdef GCC2_HACK
+ "pmullw _MMX_Ycoeff, %%mm6\n" // lum1
+-#else
+- "pmullw %[_MMX_Ycoeff], %%mm6\n" // lum1
+-#endif
+ "paddw %%mm3, %%mm2\n" // Cb2green + Cr2green == green
+-#ifdef GCC2_HACK
+ "pmullw _MMX_Ycoeff, %%mm7\n" // lum2
+-#else
+- "pmullw %[_MMX_Ycoeff], %%mm7\n" // lum2
+-#endif
+
+ "movq %%mm6, %%mm4\n" // lum1
+ "paddw %%mm0, %%mm6\n" // lum1 +blue 00 B6 00 B4 00 B2 00 B0
+@@ -366,20 +295,11 @@ void Color565DitherYV12MMX1X( int *color
+ "punpcklbw %%mm4, %%mm4\n"
+ "punpcklbw %%mm5, %%mm5\n"
+
+-#ifdef GCC2_HACK
+ "pand _MMX_red565, %%mm4\n"
+-#else
+- "pand %[_MMX_red565], %%mm4\n"
+-#endif
+ "psllw $3, %%mm5\n" // GREEN 1
+ "punpcklbw %%mm6, %%mm6\n"
+-#ifdef GCC2_HACK
+ "pand _MMX_grn565, %%mm5\n"
+ "pand _MMX_red565, %%mm6\n"
+-#else
+- "pand %[_MMX_grn565], %%mm5\n"
+- "pand %[_MMX_red565], %%mm6\n"
+-#endif
+ "por %%mm5, %%mm4\n" //
+ "psrlw $11, %%mm6\n" // BLUE 1
+ "movq %%mm3, %%mm5\n" // lum2
+@@ -393,44 +313,23 @@ void Color565DitherYV12MMX1X( int *color
+ "packuswb %%mm3, %%mm3\n"
+ "packuswb %%mm5, %%mm5\n"
+ "packuswb %%mm7, %%mm7\n"
+-#ifdef GCC2_HACK
+ "pand _MMX_00FFw, %%mm6\n" // L3
+-#else
+- "pand %[_MMX_00FFw], %%mm6\n" // L3
+-#endif
+ "punpcklbw %%mm3, %%mm3\n"
+ "punpcklbw %%mm5, %%mm5\n"
+-#ifdef GCC2_HACK
+ "pmullw _MMX_Ycoeff, %%mm6\n" // lum3
+-#else
+- "pmullw %[_MMX_Ycoeff], %%mm6\n" // lum3
+-#endif
+ "punpcklbw %%mm7, %%mm7\n"
+ "psllw $3, %%mm5\n" // GREEN 2
+-#ifdef GCC2_HACK
+ "pand _MMX_red565, %%mm7\n"
+ "pand _MMX_red565, %%mm3\n"
+-#else
+- "pand %[_MMX_red565], %%mm7\n"
+- "pand %[_MMX_red565], %%mm3\n"
+-#endif
+ "psrlw $11, %%mm7\n" // BLUE 2
+-#ifdef GCC2_HACK
+ "pand _MMX_grn565, %%mm5\n"
+-#else
+- "pand %[_MMX_grn565], %%mm5\n"
+-#endif
+ "por %%mm7, %%mm3\n"
+ "movq (%2,%4), %%mm7\n" // L4 load lum2
+ "por %%mm5, %%mm3\n" //
+ "psrlw $8, %%mm7\n" // L4
+ "movq %%mm4, %%mm5\n"
+ "punpcklwd %%mm3, %%mm4\n"
+-#ifdef GCC2_HACK
+ "pmullw _MMX_Ycoeff, %%mm7\n" // lum4
+-#else
+- "pmullw %[_MMX_Ycoeff], %%mm7\n" // lum4
+-#endif
+ "punpckhwd %%mm3, %%mm5\n"
+
+ "movq %%mm4, (%3)\n" // write row1
+@@ -457,20 +356,11 @@ void Color565DitherYV12MMX1X( int *color
+ "punpcklbw %%mm5, %%mm5\n"
+ "punpcklbw %%mm6, %%mm6\n"
+ "psllw $3, %%mm5\n" // GREEN 3
+-#ifdef GCC2_HACK
+ "pand _MMX_red565, %%mm4\n"
+-#else
+- "pand %[_MMX_red565], %%mm4\n"
+-#endif
+ "psraw $6, %%mm3\n" // psr 6
+ "psraw $6, %%mm0\n"
+-#ifdef GCC2_HACK
+ "pand _MMX_red565, %%mm6\n" // BLUE
+ "pand _MMX_grn565, %%mm5\n"
+-#else
+- "pand %[_MMX_red565], %%mm6\n" // BLUE
+- "pand %[_MMX_grn565], %%mm5\n"
+-#endif
+ "psrlw $11, %%mm6\n" // BLUE 3
+ "por %%mm5, %%mm4\n"
+ "psraw $6, %%mm7\n"
+@@ -481,20 +371,11 @@ void Color565DitherYV12MMX1X( int *color
+ "punpcklbw %%mm3, %%mm3\n"
+ "punpcklbw %%mm0, %%mm0\n"
+ "punpcklbw %%mm7, %%mm7\n"
+-#ifdef GCC2_HACK
+ "pand _MMX_red565, %%mm3\n"
+ "pand _MMX_red565, %%mm7\n" // BLUE
+-#else
+- "pand %[_MMX_red565], %%mm3\n"
+- "pand %[_MMX_red565], %%mm7\n" // BLUE
+-#endif
+ "psllw $3, %%mm0\n" // GREEN 4
+ "psrlw $11, %%mm7\n"
+-#ifdef GCC2_HACK
+ "pand _MMX_grn565, %%mm0\n"
+-#else
+- "pand %[_MMX_grn565], %%mm0\n"
+-#endif
+ "por %%mm7, %%mm3\n"
+ "por %%mm0, %%mm3\n"
+
+@@ -526,21 +407,7 @@ void Color565DitherYV12MMX1X( int *color
+ "popl %%ebx\n"
+ :
+ :"m" (cr), "r"(cb),"r"(lum),
+- "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod)
+-#ifndef GCC2_HACK
+- ,[_MMX_0080w] "m" (*MMX_0080w),
+- [_MMX_Ugrn565] "m" (*MMX_Ugrn565),
+- [_MMX_Ublu5x5] "m" (*MMX_Ublu5x5),
+- [_MMX_00FFw] "m" (*MMX_00FFw),
+- [_MMX_Vgrn565] "m" (*MMX_Vgrn565),
+- [_MMX_Vred5x5] "m" (*MMX_Vred5x5),
+- [_MMX_Ycoeff] "m" (*MMX_Ycoeff),
+- [_MMX_red565] "m" (*MMX_red565),
+- [_MMX_grn565] "m" (*MMX_grn565)
+-#endif
+- );
++ "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod));
+ }
+
+-#undef GCC2_HACK
+-
+ #endif /* GCC i386 inline assembly */
diff --git a/media-libs/libsdl/files/libsdl-1.2.9-no-exec-stack.patch b/media-libs/libsdl/files/libsdl-1.2.9-no-exec-stack.patch
new file mode 100644
index 000000000000..4dd6e9d79bcc
--- /dev/null
+++ b/media-libs/libsdl/files/libsdl-1.2.9-no-exec-stack.patch
@@ -0,0 +1,44 @@
+Fixes from the PaX team to eliminate executable stack markings
+
+--- src/hermes/mmx_main.asm
++++ src/hermes/mmx_main.asm
+@@ -70,5 +68,4 @@ endconvert:
+
+ ret
+
+-
+-
++section .note.GNU-stack noalloc noexec nowrite progbits
+--- src/hermes/mmxp2_32.asm
++++ src/hermes/mmxp2_32.asm
+@@ -381,6 +381,5 @@ _convert_bgr555_cheat:
+
+ .L4:
+ jmp _mmxreturn
+
+-
+-
++section .note.GNU-stack noalloc noexec nowrite progbits
+--- src/hermes/x86_main.asm
++++ src/hermes/x86_main.asm
+@@ -123,3 +123,5 @@ _Hermes_X86_CPU:
+
+ .L1:
+ ret
++
++section .note.GNU-stack noalloc noexec nowrite progbits
+--- src/hermes/x86p_16.asm
++++ src/hermes/x86p_16.asm
+@@ -494,3 +494,4 @@ _ConvertX86p16_8RGB332:
+ .L7 pop ebp
+ jmp _x86return
+
++section .note.GNU-stack noalloc noexec nowrite progbits
+--- src/hermes/x86p_32.asm
++++ src/hermes/x86p_32.asm
+@@ -1041,3 +1041,5 @@ _ConvertX86p32_8RGB332:
+
+ .L4:
+ jmp _x86return
++
++section .note.GNU-stack noalloc noexec nowrite progbits
diff --git a/media-libs/libsdl/files/libsdl-1.2.9-sdl-blit-mmx-check.patch b/media-libs/libsdl/files/libsdl-1.2.9-sdl-blit-mmx-check.patch
new file mode 100644
index 000000000000..9357cd243fa8
--- /dev/null
+++ b/media-libs/libsdl/files/libsdl-1.2.9-sdl-blit-mmx-check.patch
@@ -0,0 +1,15 @@
+Fix segfaults when playing games like bomberclone
+
+http://bugs.gentoo.org/104533
+
+--- src/video/SDL_blit_N.c
++++ src/video/SDL_blit_N.c
+@@ -2245,7 +2245,7 @@
+ MASKOK(dstfmt->Bmask, table[which].dstB) &&
+ dstfmt->BytesPerPixel == table[which].dstbpp &&
+ (a_need & table[which].alpha) == a_need &&
+- ((table[which].blit_features & GetBlitFeatures()) == table[which].blit_features) )
++ (table[which].blit_features & GetBlitFeatures()))
+ break;
+ }
+ sdata->aux_data = table[which].aux_data;