Module Name:    src
Committed By:   snj
Date:           Thu Nov  7 20:23:46 UTC 2013

Modified Files:
        src/libexec/ld.elf_so [netbsd-6]: tls.c
        src/tests/lib/libc/tls/dso [netbsd-6]: h_tls_dlopen.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #976):
        libexec/ld.elf_so/tls.c: revision 1.9
        tests/lib/libc/tls/dso/h_tls_dlopen.c: revision 1.5
Only initialise TLS space from the PT_TLS segment, if the size is
positive and the offset has been computed. Fixes PR lib/48324.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.6.1 src/libexec/ld.elf_so/tls.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/tests/lib/libc/tls/dso/h_tls_dlopen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/tls.c
diff -u src/libexec/ld.elf_so/tls.c:1.7 src/libexec/ld.elf_so/tls.c:1.7.6.1
--- src/libexec/ld.elf_so/tls.c:1.7	Sat Apr 23 16:40:08 2011
+++ src/libexec/ld.elf_so/tls.c	Thu Nov  7 20:23:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.7 2011/04/23 16:40:08 joerg Exp $	*/
+/*	$NetBSD: tls.c,v 1.7.6.1 2013/11/07 20:23:46 snj Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: tls.c,v 1.7 2011/04/23 16:40:08 joerg Exp $");
+__RCSID("$NetBSD: tls.c,v 1.7.6.1 2013/11/07 20:23:46 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/ucontext.h>
@@ -138,7 +138,7 @@ _rtld_tls_allocate_locked(void)
 	SET_DTV_GENERATION(tcb->tcb_dtv, _rtld_tls_dtv_generation);
 
 	for (obj = _rtld_objlist; obj != NULL; obj = obj->next) {
-		if (obj->tlssize) {
+		if (obj->tlsinitsize && obj->tls_done) {
 #ifdef __HAVE_TLS_VARIANT_I
 			q = p + obj->tlsoffset;
 #else

Index: src/tests/lib/libc/tls/dso/h_tls_dlopen.c
diff -u src/tests/lib/libc/tls/dso/h_tls_dlopen.c:1.4 src/tests/lib/libc/tls/dso/h_tls_dlopen.c:1.4.2.1
--- src/tests/lib/libc/tls/dso/h_tls_dlopen.c:1.4	Tue Jan 17 20:34:57 2012
+++ src/tests/lib/libc/tls/dso/h_tls_dlopen.c	Thu Nov  7 20:23:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_tls_dlopen.c,v 1.4 2012/01/17 20:34:57 joerg Exp $	*/
+/*	$NetBSD: h_tls_dlopen.c,v 1.4.2.1 2013/11/07 20:23:46 snj Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: h_tls_dlopen.c,v 1.4 2012/01/17 20:34:57 joerg Exp $");
+__RCSID("$NetBSD: h_tls_dlopen.c,v 1.4.2.1 2013/11/07 20:23:46 snj Exp $");
 
 #include <atf-c.h>
 #include <unistd.h>
@@ -45,6 +45,7 @@ __RCSID("$NetBSD: h_tls_dlopen.c,v 1.4 2
 extern __thread int var1;
 extern __thread int var2;
 extern __thread int *var3;
+__thread int var5 = 1;
 static __thread pid_t (*local_var)(void) = getpid;
 
 void testf_dso_helper(int x, int y);

Reply via email to