svn commit: trunk/uClibc/ldso: include ldso

bernds at uclibc.org bernds at uclibc.org
Mon Dec 3 23:10:17 UTC 2007


Author: bernds
Date: 2007-12-03 15:10:14 -0800 (Mon, 03 Dec 2007)
New Revision: 20616

Log:
Blackfin FD-PIC patches 5/6.
A couple more target macros for ld.so to deal with FD-PIC support.  We need
special code to compute the initial got and dpnt, and we need to pass extra
arguments to _dl_get_ready_to_run.



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


Changeset:
Modified: trunk/uClibc/ldso/include/dl-defs.h
===================================================================
--- trunk/uClibc/ldso/include/dl-defs.h	2007-12-03 23:01:56 UTC (rev 20615)
+++ trunk/uClibc/ldso/include/dl-defs.h	2007-12-03 23:10:14 UTC (rev 20616)
@@ -95,6 +95,20 @@
 	((LOADADDR) + (ADDR))
 #endif
 
+/* Initialize the location of the dynamic addr.  This is only called
+ * from DL_START, so additional arguments passed to it may be referenced.  */
+#ifndef DL_BOOT_COMPUTE_DYN
+#define DL_BOOT_COMPUTE_DYN(DPNT, GOT, LOAD_ADDR) \
+    ((DPNT) = ((ElfW(Dyn) *) DL_RELOC_ADDR(load_addr, got)))
+#endif
+
+/* Initialize the location of the global offset table.  This is only called
+ * from DL_START, so additional arguments passed to it may be referenced.  */
+#ifndef DL_BOOT_COMPUTE_GOT
+#define DL_BOOT_COMPUTE_GOT(GOT) \
+    ((GOT) = elf_machine_dynamic())
+#endif
+
 /* Initialize a LOADADDR representing the loader itself.  It's only
  * called from DL_BOOT, so additional arguments passed to it may be
  * referenced.

Modified: trunk/uClibc/ldso/include/ldso.h
===================================================================
--- trunk/uClibc/ldso/include/ldso.h	2007-12-03 23:01:56 UTC (rev 20615)
+++ trunk/uClibc/ldso/include/ldso.h	2007-12-03 23:10:14 UTC (rev 20616)
@@ -106,7 +106,15 @@
 extern char *_dl_strdup(const char *string);
 extern void _dl_dprintf(int, const char *, ...);
 
+#ifndef DL_GET_READY_TO_RUN_EXTRA_PARMS
+# define DL_GET_READY_TO_RUN_EXTRA_PARMS
+#endif
+#ifndef DL_GET_READY_TO_RUN_EXTRA_ARGS
+# define DL_GET_READY_TO_RUN_EXTRA_ARGS
+#endif
+
 extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
-                                 ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv);
+		ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
+		DL_GET_READY_TO_RUN_EXTRA_PARMS);
 
 #endif /* _LDSO_H_ */

Modified: trunk/uClibc/ldso/ldso/dl-startup.c
===================================================================
--- trunk/uClibc/ldso/ldso/dl-startup.c	2007-12-03 23:01:56 UTC (rev 20615)
+++ trunk/uClibc/ldso/ldso/dl-startup.c	2007-12-03 23:10:14 UTC (rev 20616)
@@ -192,8 +192,11 @@
 	 * we can take advantage of the magic offset register, if we
 	 * happen to know what that is for this architecture.  If not,
 	 * 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);
+	DL_BOOT_COMPUTE_GOT(got);
+
+	/* Now, finally, fix up the location of the dynamic stuff */
+	DL_BOOT_COMPUTE_DYN (dpnt, got, load_addr);
+
 	SEND_EARLY_STDERR_DEBUG("First Dynamic section entry=");
 	SEND_ADDRESS_STDERR_DEBUG(dpnt, 1);
 	_dl_memset(tpnt, 0, sizeof(struct elf_resolve));
@@ -304,7 +307,8 @@
 
 	__rtld_stack_end = (void *)(argv - 1);
 
-	_dl_get_ready_to_run(tpnt, load_addr, auxvt, envp, argv);
+	_dl_get_ready_to_run(tpnt, load_addr, auxvt, envp, argv
+			     DL_GET_READY_TO_RUN_EXTRA_ARGS);
 
 
 	/* Transfer control to the application.  */

Modified: trunk/uClibc/ldso/ldso/ldso.c
===================================================================
--- trunk/uClibc/ldso/ldso/ldso.c	2007-12-03 23:01:56 UTC (rev 20615)
+++ trunk/uClibc/ldso/ldso/ldso.c	2007-12-03 23:10:14 UTC (rev 20616)
@@ -131,8 +131,9 @@
 }
 
 void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
-                          ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp,
-                          char **argv)
+			  ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp,
+			  char **argv
+			  DL_GET_READY_TO_RUN_EXTRA_PARMS)
 {
 	ElfW(Phdr) *ppnt;
 	ElfW(Dyn) *dpnt;
@@ -313,7 +314,7 @@
 			/* OK, we have what we need - slip this one into the list. */
 			app_tpnt = _dl_add_elf_hash_table(_dl_progname, app_tpnt->loadaddr,
 					app_tpnt->dynamic_info,
-					DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr),
+					(unsigned long) DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr),
 					ppnt->p_filesz);
 			_dl_loaded_modules->libtype = elf_executable;
 			_dl_loaded_modules->ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val;
@@ -345,7 +346,7 @@
 			if (ptmp != _dl_ldsopath)
 				*ptmp = '\0';
 
-			_dl_debug_early("Lib Loader: (%x) %s\n", DL_LOADADDR_BASE(tpnt->loadaddr), tpnt->libname);
+			_dl_debug_early("Lib Loader: (%x) %s\n", (unsigned) DL_LOADADDR_BASE(tpnt->loadaddr), tpnt->libname);
 		}
 	}
 	app_tpnt->relro_addr = relro_addr;




More information about the uClibc-cvs mailing list