[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compile Errors on 64bit



Today in the support channel, a user came by with errors while trying to
compile on 64 bit.

http://pastebin.com/d2eaa1d6

I believe the following two patches (taken from the Debian version)
solve the problem.

10_gcc4_asm.diff

Index: wrlib/x86_specific.c
===================================================================
--- wrlib/x86_specific.c	(revision 41)
+++ wrlib/x86_specific.c	(working copy)
@@ -98,15 +98,23 @@
                            int height,
                            int line_offset)
 {
-    long long rrggbbaa;
-    long long pixel;
+    union {
+	long long rrggbbaa;
+	struct {short int rr, gg, bb, aa;} words;
+    } rrggbbaa;
+    
+    union {
+	long long pixel;
+	struct {short int rr, gg, bb, aa;} words;
+    } pixel;
+
     short *tmp_err;
     short *tmp_nerr;
     int x;
 
     asm volatile
         (
-         "pushal                        \n\t"
+         "pushl %%ebx                        \n\t"
 
          // pack dr, dg and db into mm6
          "movl  %7, %%eax               \n\t"
@@ -290,7 +298,7 @@
 
 ".Enda:                                 \n\t" // THE END
          "emms                          \n\t"
-         "popal                         \n\t"
+         "popl %%ebx                         \n\t"
          :
          :
          "m" (image),                      // %0
@@ -309,17 +317,18 @@
          "m" (width),                      // %13
          "m" (height),                     // %14
          "m" (line_offset),                // %15
-         "m" (rrggbbaa),                   // %16 (access to rr)
-         "m" ((*((short*)(&rrggbbaa)+1))), // %17 (access to gg)
-         "m" ((*((short*)(&rrggbbaa)+2))), // %18 (access to bb)
-         "m" ((*((short*)(&rrggbbaa)+3))), // %19 (access to aa)
-         "m" (pixel),                      // %20 (access to pixel.r)
-         "m" ((*((short*)(&pixel)+1))),    // %21 (access to pixel.g)
-         "m" ((*((short*)(&pixel)+2))),    // %22 (access to pixel.b)
-         "m" ((*((short*)(&pixel)+3))),    // %23 (access to pixel.a)
+         "m" (rrggbbaa.rrggbbaa),          // %16 (access to rr)
+         "m" (rrggbbaa.words.gg),          // %17 (access to gg)
+         "m" (rrggbbaa.words.bb),          // %18 (access to bb)
+         "m" (rrggbbaa.words.aa),          // %19 (access to aa)
+         "m" (pixel.pixel),                // %20 (access to pixel.r)
+         "m" (pixel.words.gg),             // %21 (access to pixel.g)
+         "m" (pixel.words.bb),             // %22 (access to pixel.b)
+         "m" (pixel.words.aa),             // %23 (access to pixel.a)
          "m" (tmp_err),                    // %24
          "m" (tmp_nerr),                   // %25
          "m" (x)                           // %26
+	 : "eax", "ecx", "edx", "esi", "edi"
         );
 }
 
@@ -342,8 +351,15 @@
                            int height,
                            int line_offset)
 {
-    long long rrggbbaa;
-    long long pixel;
+    union {
+	long long rrggbbaa;
+	struct {short int rr, gg, bb, aa;} words;
+    } rrggbbaa;
+    
+    union {
+	long long pixel;
+	struct {short int rr, gg, bb, aa;} words;
+    } pixel;
 
     short *tmp_err;
     short *tmp_nerr;
@@ -354,7 +370,7 @@
 
     asm volatile
         (
-         "pushal                        \n\t"
+         "pushl %%ebx                        \n\t"
 
          "movl %13, %%eax               \n\t" // eax = width
          "movl %%eax, %%ebx             \n\t"
@@ -424,7 +440,7 @@
 
 ".Endc:                                 \n\t" // THE END
          "emms                          \n\t"
-         "popal                         \n\t"
+         "popl %%ebx                         \n\t"
          :
          :
          "m" (image),                      // %0
@@ -443,19 +459,20 @@
          "m" (width),                      // %13
          "m" (height),                     // %14
          "m" (line_offset),                // %15
-         "m" (rrggbbaa),                   // %16 (access to rr)
-         "m" ((*((short*)(&rrggbbaa)+1))), // %17 (access to gg)
-         "m" ((*((short*)(&rrggbbaa)+2))), // %18 (access to bb)
-         "m" ((*((short*)(&rrggbbaa)+3))), // %19 (access to aa)
-         "m" (pixel),                      // %20 (access to pixel.r)
-         "m" ((*((short*)(&pixel)+1))),    // %21 (access to pixel.g)
-         "m" ((*((short*)(&pixel)+2))),    // %22 (access to pixel.b)
-         "m" ((*((short*)(&pixel)+3))),    // %23 (access to pixel.a)
+         "m" (rrggbbaa.rrggbbaa),          // %16 (access to rr)
+         "m" (rrggbbaa.words.gg),          // %17 (access to gg)
+         "m" (rrggbbaa.words.bb),          // %18 (access to bb)
+         "m" (rrggbbaa.words.aa),          // %19 (access to aa)
+         "m" (pixel.pixel),                // %20 (access to pixel.r)
+         "m" (pixel.words.gg),             // %21 (access to pixel.g)
+         "m" (pixel.words.bb),             // %22 (access to pixel.b)
+         "m" (pixel.words.aa),             // %23 (access to pixel.a)
          "m" (tmp_err),                    // %24
          "m" (tmp_nerr),                   // %25
          "m" (x),                          // %26
          "m" (w1),                         // %27
          "m" (w2)                          // %28
+	  : "eax", "ecx", "edx", "esi", "edi"
         );
 }
 
Index: configure.ac
===================================================================
--- configure.ac	(revision 44)
+++ configure.ac	(working copy)
@@ -197,7 +197,7 @@
 
     AC_CACHE_CHECK(whether gcc supports x86 inline asm,
                    ac_cv_c_inline_asm,
-                   [AC_TRY_LINK(,[{int x; asm volatile("movl %%eax, %%ebx\n"::
+                   [AC_TRY_LINK(,[{int x; asm volatile("movl %%eax, %%ebx\n\t pushal\n\t popal"::
                           "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x),
                           "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x));}],
                    ac_cv_c_inline_asm=yes,

21_endian+64bit.diff

diff -ur WindowMaker-0.91.0/src/wmspec.c WindowMaker-0.91.0-test/src/wmspec.c
--- WindowMaker-0.91.0/src/wmspec.c	2004-10-24 15:36:15.000000000 -0400
+++ WindowMaker-0.91.0-test/src/wmspec.c	2005-03-13 14:25:18.860008096 -0500
@@ -27,6 +27,7 @@
 
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
+#include <X11/Xarch.h>
 #include <string.h>
 
 #include "WindowMaker.h"
@@ -314,15 +315,15 @@
 void
 wNETWMUpdateDesktop(WScreen *scr)
 {
-    CARD32 *views, sizes[2];
+    long *views, sizes[2];
     int count, i;
 
     if (scr->workspace_count==0)
         return;
 
     count = scr->workspace_count * 2;
-    views = wmalloc(sizeof(CARD32) * count);
-    /*memset(views, 0, sizeof(CARD32) * count);*/
+    views = wmalloc(sizeof(long) * count);
+    /*memset(views, 0, sizeof(long) * count);*/
 
 #ifdef VIRTUAL_DESKTOP
     sizes[0] = scr->workspaces[scr->current_workspace]->width;
@@ -362,7 +363,7 @@
                                0, 1, &count);
     if (prop)
     {
-        int desktop= *(CARD32*)prop;
+        int desktop= *(long*)prop;
         XFree(prop);
         return desktop;
     }
@@ -426,7 +441,7 @@
 static void
 updateShowDesktop(WScreen * scr, Bool show)
 {
-    CARD32 foo;
+    long foo;
 
     foo = (show == True);
     XChangeProperty(dpy, scr->root_win, net_showing_desktop, XA_CARDINAL, 32,
@@ -599,7 +614,7 @@
 void
 wNETWMUpdateWorkarea(WScreen *scr, WArea usableArea)
 {
-    CARD32 *area;
+    long *area;
     int count, i;
 
     /* XXX: not Xinerama compatible,
@@ -609,7 +624,7 @@
         return;
 
     count = scr->workspace_count * 4;
-    area = wmalloc(sizeof(CARD32) * count);
+    area = wmalloc(sizeof(long) * count);
     for (i=0; i<scr->workspace_count; i++) {
         area[4*i + 0] = usableArea.x1;
         area[4*i + 1] = usableArea.y1;
@@ -732,7 +747,7 @@
 static void
 updateWorkspaceCount(WScreen *scr) /* changeable */
 {
-    CARD32 count;
+    long count;
 
     count = scr->workspace_count;
 
@@ -744,7 +759,7 @@
 static void
 updateCurrentWorkspace(WScreen *scr) /* changeable */
 {
-    CARD32 count;
+    long count;
 
     count = scr->current_workspace;
 
@@ -791,7 +806,7 @@
 static void
 updateWorkspaceHint(WWindow *wwin, Bool fake, Bool del)
 {
-    CARD32 l;
+    long l;
 
     if (del) {
         XDeleteProperty(dpy, wwin->client_win, net_wm_desktop);
Only in WindowMaker-0.91.0-test/src: wmspec.c.orig


-- 
John H. Robinson, IV          jaqque@sbih.org
                                                                 http  ((((
WARNING: I cannot be held responsible for the above,         sbih.org ( )(:[
as apparently my cats have learned how to type.          spiders.html  ((((


-- 
To unsubscribe, send mail to wmaker-dev-unsubscribe@lists.windowmaker.info.