[uClibc-cvs] uClibc/ldso/libdl Makefile, 1.27, 1.28 dlib.c, 1.26, 1.27 dlfcn.h, 1.1, NONE

Erik Andersen andersen at uclibc.org
Tue Aug 19 06:05:35 UTC 2003


Update of /var/cvs/uClibc/ldso/libdl
In directory winder:/tmp/cvs-serv5232/libdl

Modified Files:
	Makefile dlib.c 
Removed Files:
	dlfcn.h 
Log Message:
Phase one of my evil plan to clean up ld.so...


Index: Makefile
===================================================================
RCS file: /var/cvs/uClibc/ldso/libdl/Makefile,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- Makefile	28 Jan 2003 08:38:26 -0000	1.27
+++ Makefile	19 Aug 2003 06:05:32 -0000	1.28
@@ -21,9 +21,16 @@
 TOPDIR=../../
 include $(TOPDIR)Rules.mak
 
-XXFLAGS+=-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
+XXFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) \
+	-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
 	-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
-	-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\"
+	-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\" \
+	-fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include
+XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
+XXFLAGS_NOPIC:=$(XXFLAGS)
+ifeq ($(DOPIC),y)
+    XXFLAGS += $(PICFLAG)
+endif
 ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
 XXFLAGS+=-D__SUPPORT_LD_DEBUG__
 endif
@@ -50,11 +57,11 @@
 
 
 dlib.o: dlib.c
-	$(CC) -I../ldso -I../ldso/$(TARGET_ARCH) $(CFLAGS_NOPIC) $(XXFLAGS) -c dlib.c -o dlib.o
+	$(CC) $(XXFLAGS_NOPIC) -c dlib.c -o dlib.o
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 dlib_pic.o: dlib.c
-	$(CC) -I../ldso -I../ldso/$(TARGET_ARCH) $(CFLAGS) $(XXFLAGS) -c dlib.c -o dlib_pic.o
+	$(CC) $(XXFLAGS) -c dlib.c -o dlib_pic.o
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 $(OBJ): Makefile

Index: dlib.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/libdl/dlib.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- dlib.c	27 Jun 2003 11:45:12 -0000	1.26
+++ dlib.c	19 Aug 2003 06:05:32 -0000	1.27
@@ -4,27 +4,17 @@
  * Functions required for dlopen et. al.
  */
 
-#include <stdlib.h>
-#include <features.h>
-#include "dlfcn.h"
-#include "linuxelf.h"
-#include "ld_syscall.h"
-#include "ld_hash.h"
-#include "ld_string.h"
-
-extern struct r_debug *_dl_debug_addr;
+#include <ldso.h>
 
-extern void *(*_dl_malloc_function) (size_t size);
-
-static int do_fixup(struct elf_resolve *tpnt, int flag);
-static int do_dlclose(void *, int need_fini);
 
+/* The public interfaces */
 void *dlopen(const char *, int) __attribute__ ((__weak__, __alias__ ("_dlopen")));
-const char *dlerror(void) __attribute__ ((__weak__, __alias__ ("_dlerror")));
-void *dlsym(void *, const char *) __attribute__ ((__weak__, __alias__ ("_dlsym")));
 int dlclose(void *) __attribute__ ((__weak__, __alias__ ("_dlclose")));
+void *dlsym(void *, const char *) __attribute__ ((__weak__, __alias__ ("_dlsym")));
+const char *dlerror(void) __attribute__ ((__weak__, __alias__ ("_dlerror")));
 int dladdr(void *, Dl_info *) __attribute__ ((__weak__, __alias__ ("_dladdr")));
 
+
 #ifdef __PIC__
 /* This is a real hack.  We need access to the dynamic linker, but we
 also need to make it possible to link against this library without any
@@ -43,10 +33,10 @@
 	__attribute__ ((__weak__, __alias__ ("foobar")));
 extern struct elf_resolve * _dl_load_shared_library(int, struct dyn_elf **, struct elf_resolve *, char *)
 	__attribute__ ((__weak__, __alias__ ("foobar")));
-extern int _dl_parse_relocation_information(struct elf_resolve *, unsigned long, unsigned long, int)
-	__attribute__ ((__weak__, __alias__ ("foobar")));
-extern void _dl_parse_lazy_relocation_information(struct elf_resolve *, unsigned long, unsigned long, int)
-	__attribute__ ((__weak__, __alias__ ("foobar")));
+extern int _dl_fixup(struct elf_resolve *tpnt, int lazy)
+	 __attribute__ ((__weak__, __alias__ ("foobar")));
+extern int _dl_copy_fixups(struct dyn_elf * tpnt)
+	 __attribute__ ((__weak__, __alias__ ("foobar")));
 #ifdef __mips__
 extern void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt)
 	__attribute__ ((__weak__, __alias__ ("foobar")));
@@ -62,6 +52,9 @@
 extern struct r_debug *_dl_debug_addr __attribute__ ((__weak__, __alias__ ("foobar1")));
 extern unsigned long _dl_error_number __attribute__ ((__weak__, __alias__ ("foobar1")));
 extern void *(*_dl_malloc_function)(size_t) __attribute__ ((__weak__, __alias__ ("foobar1")));
+#ifdef __SUPPORT_LD_DEBUG__
+#define _dl_debug_file 2
+#endif
 #else
 #ifdef __SUPPORT_LD_DEBUG__
 static char *_dl_debug  = 0;
@@ -79,11 +72,16 @@
 char *_dl_ldsopath = 0;
 struct r_debug *_dl_debug_addr = NULL;
 static char *_dl_malloc_addr, *_dl_mmap_zero;
-#include "../ldso/ldso.h"               /* Pull in the name of ld.so */
+#include "../ldso/_dl_progname.h"               /* Pull in the name of ld.so */
 #include "../ldso/hash.c"
 #include "../ldso/readelflib1.c"
+void *(*_dl_malloc_function) (size_t size);
+int _dl_fixup(struct elf_resolve *tpnt, int lazy);
 #endif
 
+static int do_dlclose(void *, int need_fini);
+
+
 static const char *dl_error_names[] = {
 	"",
 	"File not found",
@@ -237,7 +235,7 @@
 	_dl_perform_mips_global_got_relocations(tpnt);
 #endif
 
-	if (do_fixup(tpnt, flag)) {
+	if (_dl_fixup(tpnt, (flag & RTLD_LAZY))) {
 		_dl_error_number = LD_NO_SYMBOL;
 		goto oops;
 	}
@@ -296,55 +294,6 @@
 	return NULL;
 }
 
-static int do_fixup(struct elf_resolve *tpnt, int flag)
-{
-	int goof = 0;
-
-	if (tpnt->next)
-		goof += do_fixup(tpnt->next, flag);
-
-	if (tpnt->dynamic_info[DT_REL]) {
-#ifdef ELF_USES_RELOCA
-		goof++;
-#else
-		if (tpnt->init_flag & RELOCS_DONE)
-			return goof;
-		tpnt->init_flag |= RELOCS_DONE;
-
-		goof += _dl_parse_relocation_information(tpnt, 
-			tpnt->dynamic_info[DT_REL], tpnt->dynamic_info[DT_RELSZ], 0);
-#endif
-	}
-	if (tpnt->dynamic_info[DT_RELA]) {
-#ifdef ELF_USES_RELOCA
-		if (tpnt->init_flag & RELOCS_DONE)
-			return goof;
-		tpnt->init_flag |= RELOCS_DONE;
-
-		goof += _dl_parse_relocation_information(tpnt, 
-			tpnt->dynamic_info[DT_RELA], tpnt->dynamic_info[DT_RELASZ], 0);
-#else
-		goof++;
-#endif
-	}
-	if (tpnt->dynamic_info[DT_JMPREL]) {
-		if (tpnt->init_flag & JMP_RELOCS_DONE)
-			return goof;
-		tpnt->init_flag |= JMP_RELOCS_DONE;
-
-		if (flag == RTLD_LAZY) {
-			_dl_parse_lazy_relocation_information(tpnt, 
-				tpnt->dynamic_info[DT_JMPREL], 
-				tpnt->dynamic_info[DT_PLTRELSZ], 0);
-		} else {
-			goof += _dl_parse_relocation_information(tpnt, 
-				tpnt->dynamic_info[DT_JMPREL], 
-				tpnt->dynamic_info[DT_PLTRELSZ], 0);
-		}
-	};
-	return goof;
-}
-
 void *_dlsym(void *vhandle, const char *name)
 {
 	struct elf_resolve *tpnt, *tfrom;
@@ -408,7 +357,7 @@
 {
 	struct dyn_elf *rpnt, *rpnt1;
 	struct dyn_elf *spnt, *spnt1;
-	elf_phdr *ppnt;
+	ElfW(Phdr) *ppnt;
 	struct elf_resolve *tpnt;
 	int (*dl_elf_fini) (void);
 	void (*dl_brk) (void);

--- dlfcn.h DELETED ---




More information about the uClibc-cvs mailing list