On Fri, 5 Nov 2010, Amit Kulkarni wrote:
> Index: lib/libc/gen/sigsetops.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/gen/sigsetops.c,v
> retrieving revision 1.5
> diff lib/libc/gen/sigsetops.c
> 34c34
> < #include <signal.h>
> ---
> > #include <sys/signal.h>

Yuck.  With that the declarations won't be visible, so a mismatch between 
declaration and definition would be missed.


> Index: lib/libpthread/arch/amd64/uthread_machdep.c
> ===================================================================
> RCS file: /cvs/src/lib/libpthread/arch/amd64/uthread_machdep.c,v
> retrieving revision 1.3
> diff lib/libpthread/arch/amd64/uthread_machdep.c
> 56c56
> <       __asm__("mov %%" #reg ", %0" : "=g"(lval))
> ---
> >       __asm__("movq %%" #reg ", %0" : "=g"(lval))
> 
> to fix
> 
> /usr/src/lib/libpthread/arch/amd64/uthread_machdep.c:72:2: error:
> ambiguous instructions require an explicit suffix (could be 'movw',
> 'movl', or
>  'movq')

<ahem>

$ make
cc -O2 -pipe -g -DPTHREAD_KERNEL -D_POSIX_THREADS -D_THREAD_SAFE -Wall 
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wsign-compare -I/home/src/src/lib/libpthread/uthread 
-I/home/src/src/lib/libpthread/include 
-I/home/src/src/lib/libpthread/../libc/include -D_LOCK_DEBUG 
-D_PTHREADS_INVARIANTS -I/home/src/src/lib/libpthread/arch/amd64    -c 
/home/src/src/lib/libpthread/arch/amd64/uthread_machdep.c -o uthread_machdep.o
{standard input}: Assembler messages:
{standard input}:44: Error: suffix or operands invalid for `movq'
{standard input}:57: Error: suffix or operands invalid for `movq'
{standard input}:69: Error: suffix or operands invalid for `movq'
{standard input}:78: Error: suffix or operands invalid for `movq'
{standard input}:86: Error: suffix or operands invalid for `movq'
*** Error code 1

Bad trade-off.

Does this diff instead work for clang?

Philip Guenther


Index: lib/libc/gen/sigsetops.c
===================================================================
RCS file: /cvs/src/lib/libc/gen/sigsetops.c,v
retrieving revision 1.5
diff -u -p -r1.5 sigsetops.c
--- lib/libc/gen/sigsetops.c    8 Aug 2005 08:05:34 -0000       1.5
+++ lib/libc/gen/sigsetops.c    6 Nov 2010 05:23:44 -0000
@@ -30,6 +30,7 @@
  *     @(#)sigsetops.c 8.1 (Berkeley) 6/4/93
  */
 
+#define _ANSI_LIBRARY
 #include <errno.h>
 #include <signal.h>
 
Index: lib/libpthread/arch/amd64/uthread_machdep.c
===================================================================
RCS file: /cvs/src/lib/libpthread/arch/amd64/uthread_machdep.c,v
retrieving revision 1.3
diff -u -p -r1.3 uthread_machdep.c
--- lib/libpthread/arch/amd64/uthread_machdep.c 25 Feb 2004 04:10:53 -0000      
1.3
+++ lib/libpthread/arch/amd64/uthread_machdep.c 6 Nov 2010 05:23:44 -0000
@@ -53,7 +53,7 @@ struct frame {
 };
 
 #define copyreg(reg, lval) \
-       __asm__("mov %%" #reg ", %0" : "=g"(lval))
+       __asm__("movl %%" #reg ", %0" : "=g"(lval))
 
 /*
  * Given a stack and an entry function, initialise a state

Reply via email to