This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2][BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC
- From: Rich Felker <dalias at libc dot org>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Fri, 20 Jun 2014 13:40:14 -0400
- Subject: Re: [PATCH v2][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 1406201803130 dot 25395 at tp dot orcam dot me dot uk>
On Fri, Jun 20, 2014 at 06:21:29PM +0100, Maciej W. Rozycki wrote:
> Index: glibc-fsf-trunk-quilt/sysdeps/arm/dl-machine.h
> ===================================================================
> --- glibc-fsf-trunk-quilt.orig/sysdeps/arm/dl-machine.h 2014-06-20 05:46:45.000000000 +0100
> +++ glibc-fsf-trunk-quilt/sysdeps/arm/dl-machine.h 2014-06-20 07:08:08.301787149 +0100
> @@ -452,7 +452,10 @@ elf_machine_rel (struct link_map *map, c
> else
> # endif
> {
> - value = sym->st_value + td->argument.value;
> + if (ELF32_R_SYM (reloc->r_info) == STN_UNDEF)
> + value = td->argument.value;
> + else
> + value = sym->st_value;
Is this logic correct in general, i.e. is the immediate addend always
(semantically) zero for symbolic relocations? Or is it legal to have a
symbolic relocation with an offset, e.g. if a module accesses x[42];
in __thread int x[50]; but no other elements and the compiler wants to
generate a relocation referencing x[42] without the need for applying
an additional offset to the address of x[0] at runtime as part of the
referencing code?
Rich