[Pkg-libatomic-ops-commits] r7 - in trunk/debian: . patches

ianw at alioth.debian.org ianw at alioth.debian.org
Fri Feb 1 01:35:28 UTC 2008


Author: ianw
Date: 2008-02-01 01:35:28 +0000 (Fri, 01 Feb 2008)
New Revision: 7

Added:
   trunk/debian/patches/07_pic_cmpxchng.patch
Modified:
   trunk/debian/changelog
Log:
fix up a PIC problem


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-02-01 00:11:07 UTC (rev 6)
+++ trunk/debian/changelog	2008-02-01 01:35:28 UTC (rev 7)
@@ -2,6 +2,8 @@
 
   * Closes: #463390 -- Add 06_double.patch to fix some issues with double
     CAS defs.  Patch by Jamey Sharp, thanks Jamey!
+  * This fixed up AO_compare_double_and_swap_double_full which then
+    revealed a PIC problem, fixed in 07_pic_cmpxchng.patch
 
  -- Ian Wienand <ianw at debian.org>  Fri, 01 Feb 2008 11:09:33 +1100
 

Added: trunk/debian/patches/07_pic_cmpxchng.patch
===================================================================
--- trunk/debian/patches/07_pic_cmpxchng.patch	                        (rev 0)
+++ trunk/debian/patches/07_pic_cmpxchng.patch	2008-02-01 01:35:28 UTC (rev 7)
@@ -0,0 +1,37 @@
+cmpxchng8b use ebx which we can't touch in PIC mode.
+
+Write a version that saves and restores
+
+Ian Wienand <ianw at ieee.org>
+
+--- libatomic-ops-1.2/src/atomic_ops/sysdeps/gcc/x86.h	2008-02-01 12:26:39.000000000 +1100
++++ libatomic-ops-1.2-new/src/atomic_ops/sysdeps/gcc/x86.h	2008-02-01 12:24:21.000000000 +1100
+@@ -141,10 +141,27 @@
+ 			               AO_t new_val1, AO_t new_val2) 
+ {
+   char result;
+-  __asm__ __volatile__("lock; cmpxchg8b %0; setz %1"
++  #if __PIC__
++  /* If PIC is turned on, we can't use %ebx as it is reserved for the
++     GOT poiner.  We can save and restore %ebx because GCC won't be
++     using it for anything else (such as any of the m operands) */
++  __asm__ __volatile__("pushl %%ebx;"   /* save ebx used for PIC GOT ptr */
++		       "movl %6,%%ebx;" /* move new_val2 to %ebx */
++		       "lock; cmpxchg8b %0; setz %1;"
++		       "pop %%ebx;"     /* restore %ebx */
++	    	       : "=m"(*addr), "=q"(result)
++		       : "m"(*addr), "d" (old_val1), "a" (old_val2),
++		         "c" (new_val1), "m" (new_val2) : "memory");
++  #else
++  /* We can't just do the same thing in non-PIC mode, because GCC
++   * might be using %ebx as the memory operand.  We could have ifdef'd
++   * in a clobber, but there's no point doing the push/pop if we don't
++   * have to. */
++  __asm__ __volatile__("lock; cmpxchg8b %0; setz %1;"
+ 	    	       : "=m"(*addr), "=q"(result)
+ 		       : "m"(*addr), "d" (old_val1), "a" (old_val2),
+ 		         "c" (new_val1), "b" (new_val2) : "memory");
++  #endif
+   return (int) result;
+ }
+ 




More information about the Pkg-libatomic-ops-commits mailing list