This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Rich Felker <dalias at libc dot org>
- Cc: <libc-alpha at sourceware dot org>
- Date: Fri, 20 Jun 2014 18:02:34 +0100
- Subject: Re: [PATCH][BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 1 dot 10 dot 1406192226490 dot 3924 at tp dot orcam dot me dot uk> <20140620024058 dot GQ179 at brightrain dot aerifal dot cx>
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