[PATCH] x86-64 TLS support

Jakub Jelinek jakub@redhat.com
Fri Sep 27 04:07:00 GMT 2002


On Fri, Sep 27, 2002 at 08:51:12AM +0200, Andreas Jaeger wrote:
> I added a few small questions below but I didn't caught anything real
> I guess.

> > +	/* GD */
> > +	.long	0x66666666
> > +	leaq	sg1@tlsgd(%rip), %rdi
> > +	call	__tls_get_addr@plt
> > +	nop;nop;nop;nop
> 
> One quick question: These nops are just fillers to separate the
> entries and not part of the GD - correct?  A nop with 4 bytes can be
> written in a better way performancewise.

The nops in the tests are to show that arbitrary instructions
in between are allowed. Plus it is a visual separator of the sequences.

> > +#  GD -> IE because variable is referenced through IE too
> > + +101c:	64 48 8b 04 25 00 00[ 	]+mov    %fs:0x0,%rax
> > + +1023:	00 00 *
> > + +1025:	48 03 05 f4 11 10 00[ 	]+add    1053172\(%rip\),%rax +# 102220 <_GLOBAL_OFFSET_TABLE_\+0x90>
> > +#				-> R_X86_64_TPOFF64	sg2
> 
> Is the TPOFF64 correct here?  Looking at your writeup I see a GOTTPOFF

Yes. GOTTPOFF is not a dynamic relocation. What the comment describes is
that the instruction points to a GOT slot which has dynamic relocation xy
against it. R_X86_64_GOTTPOFF reloc results in R_X86_64_TPOFF64 dynamic
relocation (unless it is optimized into LE sequence in which case it has
no dynamic relocation).

> > +  401064:	90[ 	]+nop *
> > +  401065:	90[ 	]+nop *
> > +  401066:	90[ 	]+nop *
> > +  401067:	90[ 	]+nop *
> > +#  LD
> 
> Isn't this a LD -> LE transition?  The header "LD" is misleading but
> this might come from the fact that you assemble the file in different
> ways.

Of course it is LD -> LE. Changed in my copy (in ld-i386/tlsbin* too).
Thanks.

	Jakub



More information about the Binutils mailing list