svn commit: branches/uClibc-nptl/ldso/ldso

sjhill at uclibc.org sjhill at uclibc.org
Wed Nov 22 20:51:09 PST 2006


Author: sjhill
Date: 2006-11-22 20:51:08 -0800 (Wed, 22 Nov 2006)
New Revision: 16643

Log:
Fix regression that showed up from merge done on 20060619. Test 'tst-tls6' was giving an incorrect return code due to memory being dynamically allocated on the stack. This is not allowed when using TLS.


Modified:
   branches/uClibc-nptl/ldso/ldso/dl-elf.c


Changeset:
Modified: branches/uClibc-nptl/ldso/ldso/dl-elf.c
===================================================================
--- branches/uClibc-nptl/ldso/ldso/dl-elf.c	2006-11-22 23:36:41 UTC (rev 16642)
+++ branches/uClibc-nptl/ldso/ldso/dl-elf.c	2006-11-23 04:51:08 UTC (rev 16643)
@@ -136,13 +136,26 @@
 search_for_named_library(const char *name, int secure, const char *path_list,
 	struct dyn_elf **rpnt)
 {
+#ifdef USE_TLS
+	char *path, *path_n;
+	char mylibname[2050];
+#else
 	char *path, *path_n, *mylibname;
+#endif
 	struct elf_resolve *tpnt;
 	int done;
 
 	if (path_list==NULL)
 		return NULL;
 
+#ifdef USE_TLS
+	/* We need a writable copy of this string */
+	path = _dl_strdup(path_list);
+	if (!path) {
+		_dl_dprintf(2, "Out of memory!\n");
+		_dl_exit(0);
+	}
+#else
 	/* We need a writable copy of this string, but we don't
 	 * need this allocated permanently since we don't want
 	 * to leak memory, so use alloca to put path on the stack */
@@ -152,18 +165,9 @@
 	/* another bit of local storage */
 	mylibname = alloca(2050);
 
-	/* gcc inlines alloca using a single instruction adjusting
-	 * the stack pointer and no stack overflow check and thus
-	 * no NULL error return.  No point leaving in dead code... */
-#if 0
-	if (!path || !mylibname) {
-		_dl_dprintf(2, "Out of memory!\n");
-		_dl_exit(0);
-	}
+	_dl_memcpy(path, path_list, done+1);
 #endif
 
-	_dl_memcpy(path, path_list, done+1);
-
 	/* Unlike ldd.c, don't bother to eliminate double //s */
 
 	/* Replace colons with zeros in path_list */



More information about the uClibc-cvs mailing list