[uClibc-cvs] CVS update of uClibc/ldso (include/ldso.h ldso/dl-startup.c ldso/ldso.c)

Joakim Tjernlund jocke at codepoet.org
Thu Aug 19 09:34:12 UTC 2004


    Date: Thursday, August 19, 2004 @ 03:34:12
  Author: jocke
    Path: /var/cvs/uClibc/ldso

Modified: include/ldso.h (1.16 -> 1.17) ldso/dl-startup.c (1.18 -> 1.19)
          ldso/ldso.c (1.108 -> 1.109)

Remove poor man's malloc. Not needed anymore.


Index: uClibc/ldso/include/ldso.h
diff -u uClibc/ldso/include/ldso.h:1.16 uClibc/ldso/include/ldso.h:1.17
--- uClibc/ldso/include/ldso.h:1.16	Thu Aug 19 03:06:15 2004
+++ uClibc/ldso/include/ldso.h	Thu Aug 19 03:34:11 2004
@@ -68,8 +68,7 @@
 extern void _dl_dprintf(int, const char *, ...);
 
 extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
-		Elf32_auxv_t auxvt[AT_EGID + 1], char **envp,
-		unsigned char *malloc_buffer, unsigned char *mmap_zero, char **argv);
+		Elf32_auxv_t auxvt[AT_EGID + 1], char **envp, char **argv);
 
 
 #endif /* _LDSO_H_ */
Index: uClibc/ldso/ldso/dl-startup.c
diff -u uClibc/ldso/ldso/dl-startup.c:1.18 uClibc/ldso/ldso/dl-startup.c:1.19
--- uClibc/ldso/ldso/dl-startup.c:1.18	Thu Aug 19 03:06:15 2004
+++ uClibc/ldso/ldso/dl-startup.c	Thu Aug 19 03:34:11 2004
@@ -90,14 +90,6 @@
 
 #include "ldso.h"
 
-/* This is a poor man's malloc, used prior to resolving our internal poor man's malloc */
-#define LD_MALLOC(SIZE) ((void *) (malloc_buffer += SIZE, malloc_buffer - SIZE)) ;  REALIGN();
-
-/* Make sure that the malloc buffer is aligned on 4 byte boundary.  For 64 bit
- * platforms we may need to increase this to 8, but this is good enough for
- * now.  This is typically called after LD_MALLOC.  */
-#define REALIGN() malloc_buffer = (char *) (((unsigned long) malloc_buffer + 3) & ~(3))
-
 /* Pull in all the arch specific stuff */
 #include "dl-startup.h"
 
@@ -126,11 +118,10 @@
 	unsigned long *aux_dat;
 	int goof = 0;
 	ElfW(Ehdr) *header;
-	struct elf_resolve *tpnt;
+	struct elf_resolve tpnt_tmp;
+	struct elf_resolve *tpnt = &tpnt_tmp;
 	Elf32_auxv_t auxvt[AT_EGID + 1];
-	unsigned char *malloc_buffer, *mmap_zero;
 	Elf32_Dyn *dpnt;
-	size_t pagesize;
 	int indx;
 #if defined(__i386__)
 	int status = 0;
@@ -283,19 +274,6 @@
 	SEND_STDERR("First Dynamic section entry=");
 	SEND_ADDRESS_STDERR(dpnt, 1);
 #endif
-
-
-	/* Call mmap to get a page of writable memory that can be used
-	 * for _dl_malloc throughout the shared lib loader. */
-	pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
-	mmap_zero = malloc_buffer = _dl_mmap((void *) 0, pagesize,
-			PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-	if (_dl_mmap_check_error(mmap_zero)) {
-		SEND_STDERR("dl_boot: mmap of a spare page failed!\n");
-		_dl_exit(13);
-	}
-
-	tpnt = LD_MALLOC(sizeof(struct elf_resolve));
 	_dl_memset(tpnt, 0, sizeof(struct elf_resolve));
 
 	/* OK, that was easy.  Next scan the DYNAMIC section of the image.
@@ -425,8 +403,7 @@
 	   free to start using global variables, since these things have all been
 	   fixed up by now.  Still no function calls outside of this library ,
 	   since the dynamic resolver is not yet ready. */
-	_dl_get_ready_to_run(tpnt, load_addr, auxvt, envp,
-			     malloc_buffer, mmap_zero, argv);
+	_dl_get_ready_to_run(tpnt, load_addr, auxvt, envp, argv);
 
 
 	/* Transfer control to the application.  */
Index: uClibc/ldso/ldso/ldso.c
diff -u uClibc/ldso/ldso/ldso.c:1.108 uClibc/ldso/ldso/ldso.c:1.109
--- uClibc/ldso/ldso/ldso.c:1.108	Thu Aug 19 03:06:15 2004
+++ uClibc/ldso/ldso/ldso.c	Thu Aug 19 03:34:11 2004
@@ -85,8 +85,7 @@
 #endif
 
 void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
-		Elf32_auxv_t auxvt[AT_EGID + 1], char **envp,
-		unsigned char *malloc_buffer, unsigned char *mmap_zero, char **argv)
+		Elf32_auxv_t auxvt[AT_EGID + 1], char **envp, char **argv)
 {
 	ElfW(Phdr) *ppnt;
 	Elf32_Dyn *dpnt;
@@ -109,14 +108,14 @@
 	SEND_STDERR("Cool, we managed to make a function call.\n");
 #endif
 
+	/* Store the page size for later use */
+	_dl_pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
 	/* Make it so _dl_malloc can use the page of memory we have already
 	 * allocated.  We shouldn't need to grab any more memory.  This must
 	 * be first since things like _dl_dprintf() use _dl_malloc().... */
-	_dl_malloc_addr = malloc_buffer;
-	_dl_mmap_zero = mmap_zero;
+	_dl_malloc_addr = (unsigned char *)_dl_pagesize;
+	_dl_mmap_zero = 0;
 
-	/* Store the page size for later use */
-	_dl_pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
 
 	/* Now we have done the mandatory linking of some things.  We are now
 	 * free to start using global variables, since these things have all been



More information about the uClibc-cvs mailing list