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

Erik Andersen andersen at codepoet.org
Wed Jul 14 23:07:47 UTC 2004


    Date: Wednesday, July 14, 2004 @ 17:07:47
  Author: andersen
    Path: /var/cvs/uClibc/ldso

Modified: include/ldso.h (1.10 -> 1.11) ldso/dl-elf.c (1.71 -> 1.72)
          ldso/dl-hash.c (1.21 -> 1.22) ldso/ldso.c (1.99 -> 1.100)
          libdl/libdl.c (1.42 -> 1.43)

Sigh.  I got things working this morning, then checked stuff in from the wrong
tree.  Bad boy, No doughnut.
 -Erik


Index: uClibc/ldso/include/ldso.h
diff -u uClibc/ldso/include/ldso.h:1.10 uClibc/ldso/include/ldso.h:1.11
--- uClibc/ldso/include/ldso.h:1.10	Wed Jul 14 06:27:02 2004
+++ uClibc/ldso/include/ldso.h	Wed Jul 14 17:07:44 2004
@@ -18,7 +18,6 @@
 #endif
 
 /* Pull in compiler and arch stuff */
-#include <stdlib.h>
 #include <stdarg.h>
 /* Pull in the arch specific type information */
 #include <sys/types.h>
Index: uClibc/ldso/ldso/dl-elf.c
diff -u uClibc/ldso/ldso/dl-elf.c:1.71 uClibc/ldso/ldso/dl-elf.c:1.72
--- uClibc/ldso/ldso/dl-elf.c:1.71	Wed Jul 14 06:27:03 2004
+++ uClibc/ldso/ldso/dl-elf.c	Wed Jul 14 17:07:45 2004
@@ -31,7 +31,6 @@
 
 
 #include "ldso.h"
-void *(*_dl_malloc_function) (size_t size) = NULL;
 
 #ifdef USE_CACHE
 
@@ -406,7 +405,7 @@
 	tpnt = _dl_check_hashed_files(libname);
 	if (tpnt) {
 		if (*rpnt) {
-			(*rpnt)->next = (struct dyn_elf *) _dl_malloc_function(sizeof(struct dyn_elf));
+			(*rpnt)->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf));
 			_dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf));
 			(*rpnt)->next->prev = (*rpnt);
 			*rpnt = (*rpnt)->next;
@@ -692,7 +691,7 @@
 	 * Add this object into the symbol chain
 	 */
 	if (*rpnt) {
-		(*rpnt)->next = (struct dyn_elf *) _dl_malloc_function(sizeof(struct dyn_elf));
+		(*rpnt)->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf));
 		_dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf));
 		(*rpnt)->next->prev = (*rpnt);
 		*rpnt = (*rpnt)->next;
@@ -884,11 +883,12 @@
 	int len;
 
 	len = _dl_strlen(string);
-	retval = _dl_malloc_function(len + 1);
+	retval = _dl_malloc(len + 1);
 	_dl_strcpy(retval, string);
 	return retval;
 }
 
+void *(*_dl_malloc_function) (size_t size) = NULL;
 union __align_type
 {
   void *p;
@@ -944,20 +944,15 @@
 	retval = _dl_malloc_addr;
 	_dl_malloc_addr += size;
 
-	/*
-	 * Align memory to 4 byte boundary.  Some platforms require this, others
-	 * simply get better performance.
-	 */
-	_dl_malloc_addr = (unsigned char *)
-		(((unsigned long) _dl_malloc_addr +
-		  __alignof__(union __align_type) - 1)
-		 & ~(__alignof__(union __align_type) - 1));
+	/* Align memory to 4 byte boundary.  Some platforms require this,
+	 * others simply get better performance.  */
+	_dl_malloc_addr = (unsigned char *) (((unsigned long) _dl_malloc_addr +
+		  __alignof__(union __align_type) - 1) & ~(__alignof__(union __align_type) - 1));
 	return retval;
 }
 
 void (*_dl_free_function) (void *p) = NULL;
-void
-_dl_free (void *p) {
+void _dl_free (void *p) {
 	if (_dl_free_function)
 		(*_dl_free_function) (p);
 }
Index: uClibc/ldso/ldso/dl-hash.c
diff -u uClibc/ldso/ldso/dl-hash.c:1.21 uClibc/ldso/ldso/dl-hash.c:1.22
--- uClibc/ldso/ldso/dl-hash.c:1.21	Wed Jul 14 06:27:03 2004
+++ uClibc/ldso/ldso/dl-hash.c	Wed Jul 14 17:07:45 2004
@@ -100,13 +100,13 @@
 	int i;
 
 	if (!_dl_loaded_modules) {
-		tpnt = _dl_loaded_modules = (struct elf_resolve *) _dl_malloc_function(sizeof(struct elf_resolve));
+		tpnt = _dl_loaded_modules = (struct elf_resolve *) _dl_malloc(sizeof(struct elf_resolve));
 		_dl_memset(tpnt, 0, sizeof(struct elf_resolve));
 	} else {
 		tpnt = _dl_loaded_modules;
 		while (tpnt->next)
 			tpnt = tpnt->next;
-		tpnt->next = (struct elf_resolve *) _dl_malloc_function(sizeof(struct elf_resolve));
+		tpnt->next = (struct elf_resolve *) _dl_malloc(sizeof(struct elf_resolve));
 		_dl_memset(tpnt->next, 0, sizeof(struct elf_resolve));
 		tpnt->next->prev = tpnt;
 		tpnt = tpnt->next;
Index: uClibc/ldso/ldso/ldso.c
diff -u uClibc/ldso/ldso/ldso.c:1.99 uClibc/ldso/ldso/ldso.c:1.100
--- uClibc/ldso/ldso/ldso.c:1.99	Wed Jul 14 06:27:03 2004
+++ uClibc/ldso/ldso/ldso.c	Wed Jul 14 17:07:45 2004
@@ -191,7 +191,7 @@
 			_dl_loaded_modules->libtype = elf_executable;
 			_dl_loaded_modules->ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_ptr;
 			_dl_loaded_modules->n_phent = auxvt[AT_PHNUM].a_un.a_val;
-			_dl_symbol_tables = rpnt = (struct dyn_elf *) _dl_malloc_function(sizeof(struct dyn_elf));
+			_dl_symbol_tables = rpnt = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf));
 			_dl_memset(rpnt, 0, sizeof(struct dyn_elf));
 			rpnt->dyn = _dl_loaded_modules;
 			app_tpnt->usage_count++;
@@ -296,7 +296,7 @@
 			len1 = _dl_strlen(dl_debug_output);
 			len2 = _dl_strlen(tmp1);
 
-			filename = _dl_malloc_function(len1+len2+2);
+			filename = _dl_malloc(len1+len2+2);
 
 			if (filename)
 			{
@@ -563,12 +563,12 @@
 			tpnt->prev = NULL;
 		}
 		if (rpnt) {
-			rpnt->next = (struct dyn_elf *) _dl_malloc_function(sizeof(struct dyn_elf));
+			rpnt->next = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf));
 			_dl_memset(rpnt->next, 0, sizeof(struct dyn_elf));
 			rpnt->next->prev = rpnt;
 			rpnt = rpnt->next;
 		} else {
-			rpnt = (struct dyn_elf *) _dl_malloc_function(sizeof(struct dyn_elf));
+			rpnt = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf));
 			_dl_memset(rpnt, 0, sizeof(struct dyn_elf));
 		}
 		rpnt->dyn = tpnt;
Index: uClibc/ldso/libdl/libdl.c
diff -u uClibc/ldso/libdl/libdl.c:1.42 uClibc/ldso/libdl/libdl.c:1.43
--- uClibc/ldso/libdl/libdl.c:1.42	Wed Jul 14 06:27:03 2004
+++ uClibc/ldso/libdl/libdl.c	Wed Jul 14 17:07:46 2004
@@ -55,6 +55,8 @@
 extern unsigned long _dl_error_number __attribute__ ((__weak__));
 extern void *(*_dl_malloc_function)(size_t) __attribute__ ((__weak__));
 extern void (*_dl_free_function) (void *p) __attribute__ ((__weak__));
+extern void *(*malloc)(size_t size) __attribute__ ((__weak__));
+extern void (*free)(void *ptr) __attribute__ ((__weak__));
 #ifdef USE_CACHE
 int _dl_map_cache(void) __attribute__ ((__weak__));
 int _dl_unmap_cache(void) __attribute__ ((__weak__));
@@ -103,6 +105,9 @@
 #define _dl_trace_loaded_objects    0
 #include "../ldso/dl-elf.c"
 #endif
+void *(*malloc)(size_t size) __attribute__ ((__weak__));
+void (*free)(void *ptr) __attribute__ ((__weak__));
+extern int atexit(void (*function)(void));
 
 static int do_dlclose(void *, int need_fini);
 



More information about the uClibc-cvs mailing list