This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch master updated. glibc-2.19-831-g9c82da1


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  9c82da17b5794efebe005de2fd22d61a3ea4b58a (commit)
      from  831b9896d8e957580591a3cbe11dcd5ac6743ba2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9c82da17b5794efebe005de2fd22d61a3ea4b58a

commit 9c82da17b5794efebe005de2fd22d61a3ea4b58a
Author: Maciej W. Rozycki <macro@codesourcery.com>
Date:   Thu Jul 17 19:22:05 2014 +0100

    [BZ #17078] ARM: R_ARM_TLS_DESC prelinker support
    
    This is a change to the dynamic linker to add prelinker support for the
    R_ARM_TLS_DESC relocation.  Two cases can be considered here, the usual
    one where lazy binding is in use and the less frequent one, where
    immediate binding is requested via the use of the DF_BIND_NOW dynamic
    flag (e.g. by using the GNU linker's "-z now" option).
    
    This change only handles the first case.  In this scenario the prelinker
    does what the dynamic linker would do, that is it preinitialises
    R_ARM_TLS_DESC relocations with a pointer to the lazy specialization as
    provided with the DT_TLSDESC_PLT dynamic tag.  A conflict is
    additionally created and in the conflict resolution path the dynamic
    linker complements the work by initialising the object's pointer as
    indicated by the DT_TLSDESC_GOT dynamic tag to the linker's internal
    lazy specialization worker function and also providing the associated
    link map in the second entry of the GOT.  This step is required, because
    if prelinking is successful at the run time, then the dynamic linker's
    elf_machine_runtime_setup() function isn't called that would normally do
    so.
    
    The second case remains unresolved, because support for that scenario
    has not been implemented in the prelinker.  In this case the lazy
    specialization is unavailable and the DT_TLSDESC_PLT dynamic tag is not
    present.
    
    The prelinker could assume the common case of static specialization and
    resolve the relocation, but that would require the exposure of dynamic
    linker's specialization worker function.  Furthermore the dynamic linker
    would have to handle the relocation in the conflict resolution path and
    see if the dynamic specialization should be used instead.  This however
    would require access to data structures currently not made available to
    the conflict resolution path and therefore a redesign of this part of
    the dynamic linker.
    
    Alternatively the prelinker could defer all processing to the dynamic
    linker's conflict resolution path, but that would require similar access
    to the said data structures.
    
    Therefore the prelinker issues an error instead and the dynamic linker
    has assertions to check that DT_TLSDESC_PLT and DT_TLSDESC_GOT are in
    use in its conflict resolution path.
    
    This change resolves all TLS failures in the prelinker testsuite, as
    noted in the bug report, as well as the small test case provided there.
    Unfortunately we don't seem to have any hooks to factor in the prelinker
    (if present on a system) to testing, so at this time this fix has to
    rely on using the prelinker test suite and enabling TLS descriptors
    there for coverage.
    
    	[BZ #17078]
    	* sysdeps/arm/dl-machine.h (elf_machine_rela)
    	[RESOLVE_CONFLICT_FIND_MAP]: Handle R_ARM_TLS_DESC relocation.
    	(elf_machine_lazy_rel): Handle prelinked R_ARM_TLS_DESC entries.

diff --git a/ChangeLog b/ChangeLog
index d32f47a..0b409dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-07-17  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	[BZ #17078]
+	* sysdeps/arm/dl-machine.h (elf_machine_rela)
+	[RESOLVE_CONFLICT_FIND_MAP]: Handle R_ARM_TLS_DESC relocation.
+	(elf_machine_lazy_rel): Handle prelinked R_ARM_TLS_DESC entries.
+
 2014-07-17  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #17088]
diff --git a/NEWS b/NEWS
index aada32b..63be362 100644
--- a/NEWS
+++ b/NEWS
@@ -21,8 +21,8 @@ Version 2.20
   16882, 16885, 16888, 16890, 16912, 16915, 16916, 16917, 16918, 16922,
   16927, 16928, 16932, 16943, 16958, 16965, 16966, 16967, 16977, 16978,
   16984, 16990, 16996, 17009, 17022, 17031, 17042, 17048, 17050, 17058,
-  17061, 17062, 17069, 17075, 17079, 17084, 17086, 17088, 17092, 17097,
-  17125, 17135, 17137, 17153.
+  17061, 17062, 17069, 17075, 17078, 17079, 17084, 17086, 17088, 17092,
+  17097, 17125, 17135, 17137, 17153.
 
 * Optimized strchr implementation for AArch64.  Contributed by ARM Ltd.
 
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index d6b0c52..31a9251 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -574,6 +574,32 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	case R_ARM_ABS32:
 	  *reloc_addr = value + reloc->r_addend;
 	  break;
+#  ifdef RESOLVE_CONFLICT_FIND_MAP
+	case R_ARM_TLS_DESC:
+	  {
+	    struct tlsdesc volatile *td =
+	      (struct tlsdesc volatile *) reloc_addr;
+
+	    RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr);
+
+	    /* Make sure we know what's going on.  */
+	    assert (td->entry
+		    == (void *) (D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
+				 + map->l_addr));
+	    assert (map->l_info[ADDRIDX (DT_TLSDESC_GOT)]);
+
+	    /* Set up the lazy resolver and store the pointer to our link
+	       map in _GLOBAL_OFFSET_TABLE[1] now as for a prelinked
+	       binary elf_machine_runtime_setup() is not called and hence
+	       neither has been initialized.  */
+	    *(Elf32_Addr *) (D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_GOT)])
+			     + map->l_addr)
+	      = (Elf32_Addr) &_dl_tlsdesc_lazy_resolver;
+	    ((Elf32_Addr *) D_PTR (map, l_info[DT_PLTGOT]))[1]
+	      = (Elf32_Addr) map;
+	  }
+	  break;
+#  endif /* RESOLVE_CONFLICT_FIND_MAP */
 	case R_ARM_PC24:
           relocate_pc24 (map, value, reloc_addr, reloc->r_addend);
 	  break;
@@ -653,9 +679,11 @@ elf_machine_lazy_rel (struct link_map *map,
 	(struct tlsdesc volatile *)reloc_addr;
 
       /* The linker must have given us the parameter we need in the
-	 first GOT entry, and left the second one empty. We fill the
-	 last with the resolver address */
-      assert (td->entry == 0);
+	 first GOT entry, and left the second one empty.  The latter
+	 will have been preset by the prelinker if used though.
+	 We fill it with the resolver address.  */
+      assert (td->entry == 0
+	      || map->l_info[VALIDX (DT_GNU_PRELINKED)] != NULL);
       td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
 			  + map->l_addr);
     }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |    7 +++++++
 NEWS                     |    4 ++--
 sysdeps/arm/dl-machine.h |   34 +++++++++++++++++++++++++++++++---
 3 files changed, 40 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


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