[uClibc-cvs] CVS update of uClibc/ldso (include/ldso.h ldso/dl-elf.c libdl/libdl.c)
Erik Andersen
andersen at codepoet.org
Fri Jul 16 13:23:22 UTC 2004
Date: Friday, July 16, 2004 @ 07:23:22
Author: andersen
Path: /var/cvs/uClibc/ldso
Modified: include/ldso.h (1.11 -> 1.12) ldso/dl-elf.c (1.72 -> 1.73)
libdl/libdl.c (1.43 -> 1.44)
Revert this stuff for now
Index: uClibc/ldso/include/ldso.h
diff -u uClibc/ldso/include/ldso.h:1.11 uClibc/ldso/include/ldso.h:1.12
--- uClibc/ldso/include/ldso.h:1.11 Wed Jul 14 17:07:44 2004
+++ uClibc/ldso/include/ldso.h Fri Jul 16 07:23:21 2004
@@ -18,6 +18,7 @@
#endif
/* Pull in compiler and arch stuff */
+#include <stdlib.h>
#include <stdarg.h>
/* Pull in the arch specific type information */
#include <sys/types.h>
@@ -64,7 +65,6 @@
#endif
extern void *_dl_malloc(int size);
-extern void _dl_free(void *);
extern char *_dl_getenv(const char *symbol, char **envp);
extern void _dl_unsetenv(const char *symbol, char **envp);
extern char *_dl_strdup(const char *string);
Index: uClibc/ldso/ldso/dl-elf.c
diff -u uClibc/ldso/ldso/dl-elf.c:1.72 uClibc/ldso/ldso/dl-elf.c:1.73
--- uClibc/ldso/ldso/dl-elf.c:1.72 Wed Jul 14 17:07:45 2004
+++ uClibc/ldso/ldso/dl-elf.c Fri Jul 16 07:23:21 2004
@@ -889,16 +889,6 @@
}
void *(*_dl_malloc_function) (size_t size) = NULL;
-union __align_type
-{
- void *p;
- void (*fp)(void);
- long long ll;
-#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
- double d;
-#endif
-};
-
void *_dl_malloc(int size)
{
void *retval;
@@ -912,29 +902,11 @@
if (_dl_malloc_function)
return (*_dl_malloc_function) (size);
- if ((int)(_dl_malloc_addr - _dl_mmap_zero + size) > (int)_dl_pagesize) {
- int rounded_size;
-
- /* Since the above assumes we get a full page even if
- we request less than that, make sure we request a
- full page, since uClinux may give us less than than
- a full page. We might round even
- larger-than-a-page sizes, but we end up never
- reusing _dl_mmap_zero/_dl_malloc_addr in that case,
- so we don't do it.
-
- The actual page size doesn't really matter; as long
- as we're self-consistent here, we're safe. */
- if (size < (int)_dl_pagesize)
- rounded_size = (size + _dl_pagesize - 1) & _dl_pagesize;
- else
- rounded_size = size;
-
-
+ if (_dl_malloc_addr - _dl_mmap_zero + size > _dl_pagesize) {
#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(2, "malloc: mmapping more memory\n");
#endif
- _dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, rounded_size,
+ _dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, size,
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (_dl_mmap_check_error(_dl_mmap_zero)) {
_dl_dprintf(2, "%s: mmap of a spare page failed!\n", _dl_progname);
@@ -944,15 +916,12 @@
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 + 3) & ~(3));
return retval;
}
-void (*_dl_free_function) (void *p) = NULL;
-void _dl_free (void *p) {
- if (_dl_free_function)
- (*_dl_free_function) (p);
-}
+
Index: uClibc/ldso/libdl/libdl.c
diff -u uClibc/ldso/libdl/libdl.c:1.43 uClibc/ldso/libdl/libdl.c:1.44
--- uClibc/ldso/libdl/libdl.c:1.43 Wed Jul 14 17:07:46 2004
+++ uClibc/ldso/libdl/libdl.c Fri Jul 16 07:23:20 2004
@@ -54,9 +54,6 @@
extern struct r_debug *_dl_debug_addr __attribute__ ((__weak__));
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__));
@@ -98,16 +95,12 @@
static unsigned char *_dl_malloc_addr, *_dl_mmap_zero;
void *(*_dl_malloc_function) (size_t size);
int _dl_errno = 0;
-void (*_dl_free_function) (void *p);
int _dl_fixup(struct dyn_elf *rpnt, int lazy);
#include "../ldso/dl-progname.h" /* Pull in the name of ld.so */
#include "../ldso/dl-hash.c"
#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);
@@ -171,7 +164,6 @@
if (!dl_init) {
dl_init++;
_dl_malloc_function = malloc;
- _dl_free_function = free;
}
/* Cover the trivial case first */
More information about the uClibc-cvs
mailing list