This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH][BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC


On Fri, 20 Jun 2014, Rich Felker wrote:

> > Index: glibc-fsf-trunk-quilt/sysdeps/arm/dl-machine.h
> > ===================================================================
> > --- glibc-fsf-trunk-quilt.orig/sysdeps/arm/dl-machine.h	2014-06-19 22:24:23.731968218 +0100
> > +++ glibc-fsf-trunk-quilt/sysdeps/arm/dl-machine.h	2014-06-19 22:25:06.741661376 +0100
> > @@ -452,7 +452,10 @@ elf_machine_rel (struct link_map *map, c
> >  	    else
> >  # endif
> >  	      {
> > -		value = sym->st_value + td->argument.value;
> > +		if (td->argument.value & 0x80000000)
> > +		  value = sym->st_value;
> > +		else
> > +		  value = td->argument.value;
> 
> Can you explain why sym->st_value is completely ignored in the else
> case? My understanding is that (aside from the high-bit-set condition
> you found) td->argument.value is semantically an addend; I certainly
> don't see any way it could already contain the desired symbol value
> (offset).

 Yes, it's an addend, to the TLS segment's address, which is added later 
on:

		  td->argument.value = value + sym_map->l_tls_offset;

in this code block.  Note that sym->st_value is 0 in the local case 
anyway, which is why current code works for this one.

 However thanks for asking this question -- this is a bug fix that I made 
long ago and you made me refresh some information.  That in turn made me 
realise there are three rather than two cases (local, global lazy and 
global immediate) to be considered here and my fix only handles the two 
formers, regressing the latter.  We also need three test cases to cover 
these variants.  I'll send an update shortly.

  Maciej


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