[uClibc] uclibc-cvs-patch

John Levin levin1 at softhome.net
Wed Feb 25 21:04:13 UTC 2004


  Hi,
  	I downloaded uclibc. While compiling i had some problems.The
  atomicity.h under bits was using "0" "1". Though it is legal gcc (both
  3.2 and 2.96) seems to abort. So i have prepared a small patch for
  sucessful compilation. Moreover the gcc that comes with mdk 9.1 is
  broken in somemanner with respect to option -g3. So i had to change it
  to g0 (every other option used to produce a .file "_filename" .file 1
  "_filename") in Rules.mak. It may not apply to your compiler or your
  system.In case someone finds problems with -g3 please check with -g0
  and with changing that i could successfully compile uclibc.

  Here is the patch.

  diff -Nur tmp1/atomicity.h tmp/atomicity.h
  --- tmp1/atomicity.h	2004-02-23 15:30:22.000000000 -0500
  +++ tmp/atomicity.h	2004-02-23 15:30:09.000000000 -0500
  @@ -27,10 +27,9 @@
   __attribute__ ((unused))
   exchange_and_add (volatile uint32_t *mem, uint32_t val)
   {
  -  register uint32_t result;
     __asm__ __volatile__ ("lock; xaddl %0,%1"
  -			: "=r" (result), "=m" (*mem) : "0" (val), "1" (*mem));
  -  return result;
  +			: "+r" (val), "+m" (*mem) );
  +  return val;
   }
   
   static inline void
  @@ -38,7 +37,7 @@
   atomic_add (volatile uint32_t *mem, int val)
   {
     __asm__ __volatile__ ("lock; addl %1,%0"
  -			: "=m" (*mem) : "ir" (val), "0" (*mem));
  +			: "=m" (*mem) : "ir" (val));
   }
   
   static inline char
  @@ -50,7 +49,7 @@
   
     __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
                           : "=q" (ret), "=m" (*p), "=a" (readval)
  -                        : "r" (newval), "1" (*p), "a" (oldval));
  +                        : "r" (newval), "m" (*p), "a" (oldval));
     return ret;
   }
   


  -- -- 



More information about the uClibc mailing list