svn commit: trunk/uClibc/ldso: include ldso

vapier at uclibc.org vapier at uclibc.org
Sat Oct 7 06:36:32 UTC 2006


Author: vapier
Date: 2006-10-06 23:36:32 -0700 (Fri, 06 Oct 2006)
New Revision: 16331

Log:
Bernd Schmidt writes:
This introduces a new SEND_EARLY_STDERR macro that is to be used in 
dl-startup.c before ld.so is relocated.  It is needed on Blackfin (and 
frv) FDPIC since we have to use special tricks to get the address of a 
string constant.

EARLY_STDERR_SPECIAL gets defined on such a machine and prevents 
printing of debug strings inside the loop that relocates ld.so, since we 
can't decide which of the two variants to use.


Modified:
   trunk/uClibc/ldso/include/dl-string.h
   trunk/uClibc/ldso/ldso/dl-startup.c


Changeset:
Modified: trunk/uClibc/ldso/include/dl-string.h
===================================================================
--- trunk/uClibc/ldso/include/dl-string.h	2006-10-07 06:32:44 UTC (rev 16330)
+++ trunk/uClibc/ldso/include/dl-string.h	2006-10-07 06:36:32 UTC (rev 16331)
@@ -338,12 +338,25 @@
 }
 #endif
 
+/* Some targets may have to override this to something that doesn't
+ * reference constant strings through the GOT.  This macro should be
+ * preferred over SEND_STDERR for constant strings before we complete
+ * bootstrap.
+ */
+#ifndef SEND_EARLY_STDERR
+# define SEND_EARLY_STDERR(S) SEND_STDERR(S)
+#else
+# define EARLY_STDERR_SPECIAL
+#endif
+
 #ifdef __SUPPORT_LD_DEBUG_EARLY__
 # define SEND_STDERR_DEBUG(X) SEND_STDERR(X)
+# define SEND_EARLY_STDERR_DEBUG(X) SEND_EARLY_STDERR(X)
 # define SEND_NUMBER_STDERR_DEBUG(X, add_a_newline) SEND_NUMBER_STDERR(X, add_a_newline)
 # define SEND_ADDRESS_STDERR_DEBUG(X, add_a_newline) SEND_ADDRESS_STDERR(X, add_a_newline)
 #else
 # define SEND_STDERR_DEBUG(X)
+# define SEND_EARLY_STDERR_DEBUG(X)
 # define SEND_NUMBER_STDERR_DEBUG(X, add_a_newline)
 # define SEND_ADDRESS_STDERR_DEBUG(X, add_a_newline)
 #endif

Modified: trunk/uClibc/ldso/ldso/dl-startup.c
===================================================================
--- trunk/uClibc/ldso/ldso/dl-startup.c	2006-10-07 06:32:44 UTC (rev 16330)
+++ trunk/uClibc/ldso/ldso/dl-startup.c	2006-10-07 06:36:32 UTC (rev 16331)
@@ -137,11 +137,11 @@
 	aux_dat++;					/* Skip over NULL at end of argv */
 	envp = (char **) aux_dat;
 #ifndef NO_EARLY_SEND_STDERR
-	SEND_STDERR_DEBUG("argc=");
+	SEND_EARLY_STDERR_DEBUG("argc=");
 	SEND_NUMBER_STDERR_DEBUG(argc, 0);
-	SEND_STDERR_DEBUG(" argv=");
+	SEND_EARLY_STDERR_DEBUG(" argv=");
 	SEND_ADDRESS_STDERR_DEBUG(argv, 0);
-	SEND_STDERR_DEBUG(" envp=");
+	SEND_EARLY_STDERR_DEBUG(" envp=");
 	SEND_ADDRESS_STDERR_DEBUG(envp, 1);
 #endif
 	while (*aux_dat)
@@ -182,10 +182,10 @@
 			|| header->e_ident[EI_MAG2] != ELFMAG2
 			|| header->e_ident[EI_MAG3] != ELFMAG3)
 	{
-		SEND_STDERR("Invalid ELF header\n");
+		SEND_EARLY_STDERR("Invalid ELF header\n");
 		_dl_exit(0);
 	}
-	SEND_STDERR_DEBUG("ELF header=");
+	SEND_EARLY_STDERR_DEBUG("ELF header=");
 	SEND_ADDRESS_STDERR_DEBUG(DL_LOADADDR_BASE(load_addr), 1);
 
 	/* Locate the global offset table.  Since this code must be PIC
@@ -194,13 +194,13 @@
 	 * we can always read stuff out of the ELF file to find it... */
 	got = elf_machine_dynamic();
 	dpnt = (ElfW(Dyn) *) DL_RELOC_ADDR(load_addr, got);
-	SEND_STDERR_DEBUG("First Dynamic section entry=");
+	SEND_EARLY_STDERR_DEBUG("First Dynamic section entry=");
 	SEND_ADDRESS_STDERR_DEBUG(dpnt, 1);
 	_dl_memset(tpnt, 0, sizeof(struct elf_resolve));
 	tpnt->loadaddr = load_addr;
 	/* 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 */
-	SEND_STDERR_DEBUG("Scanning DYNAMIC section\n");
+	SEND_EARLY_STDERR_DEBUG("Scanning DYNAMIC section\n");
 	tpnt->dynamic_addr = dpnt;
 #if defined(NO_FUNCS_BEFORE_BOOTSTRAP)
 	/* Some architectures cannot call functions here, must inline */
@@ -209,11 +209,11 @@
 	_dl_parse_dynamic_info(dpnt, tpnt->dynamic_info, NULL, load_addr);
 #endif
 
-	SEND_STDERR_DEBUG("Done scanning DYNAMIC section\n");
+	SEND_EARLY_STDERR_DEBUG("Done scanning DYNAMIC section\n");
 
 #if defined(PERFORM_BOOTSTRAP_GOT)
 
-	SEND_STDERR_DEBUG("About to do specific GOT bootstrap\n");
+	SEND_EARLY_STDERR_DEBUG("About to do specific GOT bootstrap\n");
 	/* some arches (like MIPS) we have to tweak the GOT before relocations */
 	PERFORM_BOOTSTRAP_GOT(tpnt);
 
@@ -221,7 +221,7 @@
 
 	/* OK, now do the relocations.  We do not do a lazy binding here, so
 	   that once we are done, we have considerably more flexibility. */
-	SEND_STDERR_DEBUG("About to do library loader relocations\n");
+	SEND_EARLY_STDERR_DEBUG("About to do library loader relocations\n");
 
 	{
 		int goof, indx;
@@ -274,9 +274,11 @@
 					sym = &symtab[symtab_index];
 					symbol_addr = (unsigned long) DL_RELOC_ADDR(load_addr, sym->st_value);
 
+#ifndef EARLY_STDERR_SPECIAL
 					SEND_STDERR_DEBUG("relocating symbol: ");
 					SEND_STDERR_DEBUG(strtab + sym->st_name);
 					SEND_STDERR_DEBUG("\n");
+#endif
 				} else
 					SEND_STDERR_DEBUG("relocating unknown symbol\n");
 				/* Use this machine-specific macro to perform the actual relocation.  */




More information about the uClibc-cvs mailing list