New pthreads library

Richard Henderson rth@twiddle.net
Mon Aug 30 14:11:00 GMT 1999


On Mon, Aug 30, 1999 at 03:15:52AM -0400, Roland McGrath wrote:
> 	extern struct foo seg __asm__("%gs:0");
> 	static inline struct foo *
> 	the_foo(void) { return &seg; }
> 
> 	int foobar(int x)
> 	{
> 	  struct foo *me = the_foo();
> 	  return x + me->y;
> 	}
> 
> This compiles to:
> 
> 	foobar:
> 		pushl %ebp
> 		movl %esp,%ebp
> 		movl %gs:0+4,%eax

This is pretty cool, but it won't work with -fpic.  There 
we'll try something like

	movl	%gs:0@GOT(%ebx),%eax
	movl	4(%eax), %eax


r~


More information about the Libc-hacker mailing list