This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Small __asm__ fix for Alpha linuxthreads.
- From: Glen Nakamura <gen at flex dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Wed, 15 May 2002 18:17:51 -1000
- Subject: [PATCH] Small __asm__ fix for Alpha linuxthreads.
Aloha,
This patch fixes a problem I encountered when compiling glibc-2.2.5
with gcc-3.1 on alpha linux. The problem results in a segmentation fault
in pthread_setspecific() caused by gcc-3.1 optimizing away the call_pal
instruction when inlining thread_self().
I'm *not* an inline asm expert, but according to the GCC documentation:
"You may not write a clobber description in a way that overlaps
with an input or output operand."
I just deleted the clobber description since $0 is an output register
and it seems to work as expected. Any experts care to comment?
- Glen Nakamura
Index: pt-machine.h
===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/alpha/pt-machine.h,v
retrieving revision 1.7
diff -c -3 -p -r1.7 pt-machine.h
*** pt-machine.h 23 Jul 2001 17:52:42 -0000 1.7
--- pt-machine.h 16 May 2002 03:54:02 -0000
*************** testandset (int *spinlock)
*** 71,77 ****
#define THREAD_SELF \
({ \
register pthread_descr __self __asm__("$0"); \
! __asm__ ("call_pal %1" : "=r"(__self) : "i"(PAL_rduniq) : "$0"); \
__self; \
})
--- 71,77 ----
#define THREAD_SELF \
({ \
register pthread_descr __self __asm__("$0"); \
! __asm__ ("call_pal %1" : "=r"(__self) : "i"(PAL_rduniq)); \
__self; \
})