[uClibc-cvs] uClibc/ldso/ldso ldso.c,1.60,1.61

Erik Andersen andersen at codepoet.org
Wed Feb 26 01:58:48 UTC 2003


Update of /var/cvs/uClibc/ldso/ldso
In directory winder:/tmp/cvs-serv28579

Modified Files:
	ldso.c 
Log Message:
Add a bunch of additional early debugg messages into the shared 
lib loader to make it more obvious what is wrong when things puke 
early on in the process.
 -Erik


Index: ldso.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/ldso.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- ldso.c	4 Feb 2003 05:54:33 -0000	1.60
+++ ldso.c	26 Feb 2003 01:58:43 -0000	1.61
@@ -387,6 +387,9 @@
 
 	/* OK, that was easy.  Next scan the DYNAMIC section of the image.
 	   We are only doing ourself right now - we will have to do the rest later */
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+	SEND_STDERR("scanning DYNAMIC section\n");
+#endif
 	while (dpnt->d_tag) {
 #if defined(__mips__)
 		if (dpnt->d_tag == DT_MIPS_GOTSYM)
@@ -430,12 +433,13 @@
 						continue;
 					}
 					app_tpnt->dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val;
-					if (dpnt->d_tag == DT_DEBUG)
+					if (dpnt->d_tag == DT_DEBUG) {
 #ifdef FORCE_SHAREABLE_TEXT_SEGMENTS
 						dpnt->d_un.d_val = (unsigned long) debug_addr;
 #else
 						dpnt_debug = dpnt;
 #endif
+					}
 					if (dpnt->d_tag == DT_TEXTREL)
 						app_tpnt->dynamic_info[DT_TEXTREL] = 1;
 					dpnt++;
@@ -443,6 +447,10 @@
 			}
 	}
 
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+	SEND_STDERR("done scanning DYNAMIC section\n");
+#endif
+
 	/* Get some more of the information that we will need to dynamicly link
 	   this module to itself */
 
@@ -452,6 +460,10 @@
 	tpnt->elf_buckets = hash_addr;
 	hash_addr += tpnt->nbucket;
 
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+	SEND_STDERR("done grabbing link information\n");
+#endif
+
 #ifndef FORCE_SHAREABLE_TEXT_SEGMENTS
 	/* Ugly, ugly.  We need to call mprotect to change the protection of
 	   the text pages so that we can do the dynamic linking.  We can set the
@@ -461,6 +473,10 @@
 		elf_phdr *ppnt;
 		int i;
 
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+		SEND_STDERR("calling mprotect on the shared library/dynamic linker\n");
+#endif
+
 		/* First cover the shared library/dynamic linker. */
 		if (tpnt->dynamic_info[DT_TEXTREL]) {
 			header = (elfhdr *) auxvt[AT_BASE].a_un.a_ptr;
@@ -475,6 +491,9 @@
 			}
 		}
 
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+		SEND_STDERR("calling mprotect on the application program\n");
+#endif
 		/* Now cover the application program. */
 		if (app_tpnt->dynamic_info[DT_TEXTREL]) {
 			ppnt = (elf_phdr *) auxvt[AT_PHDR].a_un.a_ptr;
@@ -487,26 +506,27 @@
 			}
 		}
 	}
-
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+	SEND_STDERR("About to store the debug structure address\n");
+#endif
 	/* Now we can store the debug structure address */
 	if (dpnt_debug != NULL) {
 		dpnt_debug->d_un.d_val = (unsigned long) debug_addr;
 	}
 #endif
-
-
+	
 #if defined(__mips__)
-	/*
-	 * For MIPS we have to do stuff to the GOT before we do relocations.
-	 */
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+	SEND_STDERR("About to do MIPS specific GOT bootstrap\n");
+#endif
+	/* For MIPS we have to do stuff to the GOT before we do relocations.  */
 	PERFORM_BOOTSTRAP_GOT(got);
 #endif
 
-
 	/* OK, now do the relocations.  We do not do a lazy binding here, so
 	   that once we are done, we have considerably more flexibility. */
 #ifdef __SUPPORT_LD_DEBUG_EARLY__
-	SEND_STDERR("About to do library loader relocations.\n");
+	SEND_STDERR("About to do library loader relocations\n");
 #endif
 
 	goof = 0;




More information about the uClibc-cvs mailing list