This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IA32 TLS GD optimization issue


On Thu, Nov 06, 2003 at 06:15:31PM +0100, Jakub Jelinek wrote:
> On Thu, Nov 06, 2003 at 09:49:51AM -0800, H. J. Lu wrote:
> > The ia32 linker can optimize TLS GD to LE or IE. But they are not
> > consistent. For GD -> LE, we can turn
> > 
> > 	leal foo(%reg), %eax; call ___tls_get_addr; nop
> > 
> > into
> > 
> > 	movl %gs:0, %eax; subl $foo@tpoff, %eax	# 6 byte form of subl
> > 
> > and
> > 
> > 	leal foo(%reg), %eax; call ___tls_get_addr
> > 
> > into
> > 
> > 	movl %gs:0, %eax; subl $foo@tpoff, %eax	# 5 byte form of subl
> > 
> > But for GD -> IE, we only support
> > 
> > 	leal foo(%reg), %eax; call ___tls_get_addr; nop
> > 
> > to
> > 	movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax # 6 byte form of subl
> > 
> > since there is no 5 byte form for "subl $foo@gottpoff(%reg), %eax".
> 
> And the problem is?
> Have you read http://people.redhat.com/drepper/tls.pdf ?
> 

That document doesn't mention the code sequence

	leal foo(%reg), %eax
	call ___tls_get_addr

for GD. Should the linker even bother to support it? The current
linker will work with GD -> LE, but not GD -> IE. I think linker
shoudl enforce

	leal foo(,%reg,1), %eax
	call ___tls_get_addr

which is documented.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]