cvs commit: src/lib/libc/gen tls.c src/lib/libc/i386/gen Makefile.inc _set_tp.c src/lib/libc/include libc_private.h src/lib/libthread_xu Makefile pthread.map src/lib/libthread_xu/arch/amd64/amd64 pthread_md.c src/lib/libthread_xu/arch/amd64/include ...

Joerg Sonnenberger joerg at britannica.bec.de
Tue Mar 29 18:35:23 PST 2005


On Tue, Mar 29, 2005 at 06:25:58PM -0800, Matthew Dillon wrote:
> 
> :
> :On Tue, Mar 29, 2005 at 11:26:20AM -0800, Joerg Sonnenberger wrote:
> :> joerg       2005/03/29 11:26:20 PST
> :> 
> :>   Added files:
> :>     sys/i386/include     tls.h 
> :
> :I'm open for any advice how to teach GCC to create correct assembly
> :for the #if'd out sections.
> :
> :Joerg
> 
>     As far as GAS is concerned, it's a memory effective address (remove
>     the %gs: prefix and it becomes clear). So:
> 
> 	__asm __volatile ("movl %%gs:%1,%0" : "=r" (self) :
> 				"m" (((struct tls_tcb *)0)->self));

That's what I initialy thought too. The problem is that the above statement
is assembled to:
. LC0:
	.long 0 /* value of ((struct tls_tcb *)0)->self */

main:
	...
	movl %gs:.LC0,%eax

which is clearly something different.

Joerg





More information about the Commits mailing list