Subject: pkg/25855: devel/SDL does not build with gcc 3.4.0
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <shannonjr@NetBSD.org>
List: pkgsrc-bugs
Date: 06/07/2004 05:13:48
>Number:         25855
>Category:       pkg
>Synopsis:       devel/SDL does not build with gcc 3.4.0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 07 11:14:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     John R. Shannon
>Release:        NetBSD 2.0_BETA
>Organization:
NetBSD.org
>Environment:
System: NetBSD colleen.internal.johnrshannon.com 2.0_BETA NetBSD 2.0_BETA (KERNEL) #0: Fri Jun 4 08:18:35 MDT 2004 root@colleen.internal.johnrshannon.com:/usr/obj/usr/src/sys/arch/i386/compile/KERNEL i386
Architecture: i386
Machine: i386
>Description:
	devel/SDL does not build with gcc 3.4.0. The problem is in the inline assembly code.
>How-To-Repeat:
	Build with wip/gcc-3.4
>Fix:
	Due to Jeremy Utley (jeremy@linuxfromscratch.org)


$NetBSD$

--- src/cpuinfo/SDL_cpuinfo.c.orig	2004-02-10 08:31:35.000000000 -0700
+++ src/cpuinfo/SDL_cpuinfo.c
@@ -105,6 +105,7 @@ static __inline__ int CPU_getCPUIDFeatur
 	int features = 0;
 #if defined(__GNUC__) && defined(i386)
 	__asm__ (
+"		pushl %%ebx\n" //XXX: Jbit Hack
 "        movl    %%ebx,%%edi\n"
 "        xorl    %%eax,%%eax         # Set up for CPUID instruction    \n"
 "        cpuid                       # Get and save vendor ID          \n"
@@ -116,9 +117,10 @@ static __inline__ int CPU_getCPUIDFeatur
 "        movl    %%edx,%0                                              \n"
 "1:                                                                    \n"
 "        movl    %%edi,%%ebx\n"
+"		popl %%ebx\n" //XXX: Jbit Hack
 	: "=m" (features)
 	:
-	: "%eax", "%ebx", "%ecx", "%edx", "%edi"
+	: "%eax", "%ecx", "%edx", "%edi"
 	);
 #elif defined(_MSC_VER)
 	__asm {
@@ -141,6 +143,7 @@ static __inline__ int CPU_getCPUIDFeatur
 	int features = 0;
 #if defined(__GNUC__) && defined(i386)
 	__asm__ (
+"		pushl %%ebx\n" //XXX: Jbit Hack
 "        movl    %%ebx,%%edi\n"
 "        movl    $0x80000000,%%eax   # Query for extended functions    \n"
 "        cpuid                       # Get extended function limit     \n"
@@ -151,9 +154,10 @@ static __inline__ int CPU_getCPUIDFeatur
 "        movl    %%edx,%0                                              \n"
 "1:                                                                    \n"
 "        movl    %%edi,%%ebx\n"
+"		popl %%ebx\n" //XXX: Jbit Hack
 	: "=m" (features)
 	:
-	: "%eax", "%ebx", "%ecx", "%edx", "%edi"
+	: "%eax", "%ecx", "%edx", "%edi"
 	);
 #elif defined(_MSC_VER)
 	__asm {


$NetBSD$

--- src/audio/SDL_mixer_MMX.c.orig	2002-11-08 23:13:28.000000000 -0700
+++ src/audio/SDL_mixer_MMX.c
@@ -14,7 +14,7 @@
 void SDL_MixAudio_MMX_S16(char* dst,char* src,unsigned int size,int volume)
 {
     __asm__ __volatile__ (
-
+"	pushl %%ebx\n" //XXX: Jbit hack
 "	movl %0,%%edi\n"	// edi = dst
 "	movl %1,%%esi\n"	// esi = src
 "	movl %3,%%eax\n"	// eax = volume
@@ -102,10 +102,11 @@ void SDL_MixAudio_MMX_S16(char* dst,char
 "	emms\n"
 
 ".endS16:\n"
+"	popl %%ebx\n" //XXX: Jbit hack
 	 :
 	 : "m" (dst), "m"(src),"m"(size),
 	 "m"(volume)
-	 : "eax","ebx", "esi", "edi","memory"
+	 : "eax","esi", "edi","memory"
 	 );
 }
 
@@ -119,6 +120,7 @@ void SDL_MixAudio_MMX_S8(char* dst,char*
 {
     __asm__ __volatile__ (
 
+"	pushl %%ebx\n"		//XXX: Jbit hack
 "	movl %0,%%edi\n"	// edi = dst
 "	movl %1,%%esi\n"	// esi = src
 "	movl %3,%%eax\n"	// eax = volume
@@ -175,10 +177,11 @@ void SDL_MixAudio_MMX_S8(char* dst,char*
 
 ".endS8:\n"
 "	emms\n"
+"	popl %%ebx\n"		//XXX: Jbit hack
 	 :
 	 : "m" (dst), "m"(src),"m"(size),
 	 "m"(volume)
-	 : "eax","ebx", "esi", "edi","memory"
+	 : "eax","esi", "edi","memory"
 	 );
 }
 #endif

$NetBSD$

--- src/video/SDL_yuv_mmx.c.orig	2004-02-18 10:22:04.000000000 -0700
+++ src/video/SDL_yuv_mmx.c
@@ -238,9 +238,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)
-		 : "%ebx"
-		 );
+		 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod) );
 }
 
 void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
@@ -413,9 +411,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)
-	 : "%ebx"
-         );
+	 "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod)  );
 }
 
 #endif /* GCC i386 inline assembly */
>Release-Note:
>Audit-Trail:
>Unformatted: