Hello David.

On Wed, 20 Jul 2005 10:50:28 +0200
you wrote:

>         What workaround have you tried to build that libvgahw.a? No
> optimization, or
> an enhanced version of the X.Org patch?

Enhanced version. Attached.

gcc4 has issues with libvgahw.a. This patch is a workaround stolen from
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=161242 (by Olivier
Baudron). See also Debian #318218 and bugs merged to it

Index: xorg-x11-6.8.2.dfsg.1/programs/Xserver/hw/xfree86/vgahw/vgaHW.c
===================================================================
--- xc-old/programs/Xserver/hw/xfree86/vgahw/vgaHW.c    2005-07-20 
10:32:26.000000000 +0800
+++ xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c        2005-07-20 
10:33:42.000000000 +0800
@@ -428,12 +428,16 @@
 static void
 mmioWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value)
 {
+    volatile CARD8 tmp;
+
     if (hwp->paletteEnabled)
        index &= ~0x20;
     else
        index |= 0x20;
 
-    (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+    /* gcc-4.0 -O2 is broken : needs a volatile assignment */ 
+    tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+
     moutb(VGA_ATTR_INDEX, index);
     moutb(VGA_ATTR_DATA_W, value);
 }
@@ -441,12 +445,16 @@
 static CARD8
 mmioReadAttr(vgaHWPtr hwp, CARD8 index)
 {
+    volatile CARD8 tmp;
+  
     if (hwp->paletteEnabled)
        index &= ~0x20;
     else
        index |= 0x20;
 
-    (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+    /* gcc-4.0 -O2 is broken : needs a volatile assignment */ 
+    tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+
     moutb(VGA_ATTR_INDEX, index);
     return minb(VGA_ATTR_DATA_R);
 }
@@ -466,7 +474,11 @@
 static void
 mmioEnablePalette(vgaHWPtr hwp)
 {
-    (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+    volatile CARD8 tmp;
+    
+    /* gcc-4.0 -O2 is broken : needs a volatile assignment */ 
+    tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+    
     moutb(VGA_ATTR_INDEX, 0x00);
     hwp->paletteEnabled = TRUE;
 }
@@ -474,7 +486,11 @@
 static void
 mmioDisablePalette(vgaHWPtr hwp)
 {
-    (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+    volatile CARD8 tmp;
+    
+    /* gcc-4.0 -O2 is broken : needs a volatile assignment */ 
+    tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+    
     moutb(VGA_ATTR_INDEX, 0x20);
     hwp->paletteEnabled = FALSE;
 }

Reply via email to