Kaynağa Gözat

A ton of cleanups. Eliminate some useless code. Much better
debugging code now.
-Erik

Eric Andersen 23 yıl önce
ebeveyn
işleme
212d547707
5 değiştirilmiş dosya ile 499 ekleme ve 413 silme
  1. 6 3
      ldso/ldso/Makefile
  2. 1 1
      ldso/ldso/dl-elf.c
  3. 22 9
      ldso/ldso/ld_string.h
  4. 469 399
      ldso/ldso/ldso.c
  5. 1 1
      ldso/ldso/readelflib1.c

+ 6 - 3
ldso/ldso/Makefile

@@ -25,11 +25,11 @@
 TOPDIR=../../
 DOPIC=true
 include $(TOPDIR)Rules.mak
-
-
 LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so
 
-#XXFLAGS += #-DDL_DEBUG #-funroll-loops
+# Enable this to enable debugging output from ld.so
+#XXFLAGS+= -DDL_DEBUG
+
 XXFLAGS+=-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
 	-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
 	-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\"
@@ -67,6 +67,9 @@ $(AOBJS): %.o : %.S
 	$(CC) $(CFLAGS) -I. -I./$(TARGET_ARCH) -I../libdl -c $< -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
+ldso.o: ldso.c hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c \
+	ld_hash.h ld_string.h ld_syscall.h ldso.h linuxelf.h
+
 clean::
 	$(RM) -f $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i ldso.h *~
 

+ 1 - 1
ldso/ldso/dl-elf.c

@@ -384,7 +384,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
 	status = (char *) _dl_mmap((char *) (piclib ? 0 : minvma), 
 		maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0);
 	if (_dl_mmap_check_error(status)) {
-		_dl_dprintf(2, "%s: can't map '/dev/zero'\n", _dl_progname);
+		_dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname);
 		_dl_internal_error_number = DL_ERROR_MMAP_FAILED;
 		_dl_close(infile);
 		return NULL;

+ 22 - 9
ldso/ldso/ld_string.h

@@ -224,17 +224,30 @@ static inline char *_dl_simple_ltoahex(char * local, unsigned long i)
 #if defined mc68000 || defined __arm__
 /* On some arches constant strings are referenced through the GOT. */
 /* XXX Requires load_addr to be defined. */
-#define SEND_STDERR(X)				\
-  { const char *__s = (X);			\
-    if (__s < (const char *) load_addr) __s += load_addr;	\
-    _dl_write (2, __s, _dl_strlen (__s));	\
-  }
+#define SEND_STDERR(X)			\
+{					\
+    const char *ptr, *str;		\
+    ptr = str = (char *)(X);		\
+    if(str < (const char *)load_addr) {	\
+       	str += load_addr;		\
+       	ptr += load_addr;		\
+    }					\
+    while (*ptr)			\
+	ptr++;				\
+    _dl_write(2, str, ptr - str);	\
+}
 #else
-#define SEND_STDERR(X) _dl_write(2, X, _dl_strlen(X));
+#define SEND_STDERR(str)		\
+{					\
+    register char *ptr = (char *) str;	\
+    while (*ptr)			\
+	ptr++;				\
+    _dl_write(2, str, ptr - str);	\
+}
 #endif
 
 #define SEND_ADDRESS_STDERR(X, add_a_newline) { \
-    char tmp[13], *tmp1; \
+    char tmp[22], *tmp1; \
     _dl_memset(tmp, 0, sizeof(tmp)); \
     tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen(tmp1)); \
@@ -245,9 +258,9 @@ static inline char *_dl_simple_ltoahex(char * local, unsigned long i)
 };
 
 #define SEND_NUMBER_STDERR(X, add_a_newline) { \
-    char tmp[13], *tmp1; \
+    char tmp[22], *tmp1; \
     _dl_memset(tmp, 0, sizeof(tmp)); \
-    tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
+    tmp1=_dl_simple_ltoa( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen(tmp1)); \
     if (add_a_newline) { \
 	tmp[0]='\n'; \

Dosya farkı çok büyük olduğundan ihmal edildi
+ 469 - 399
ldso/ldso/ldso.c


+ 1 - 1
ldso/ldso/readelflib1.c

@@ -384,7 +384,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
 	status = (char *) _dl_mmap((char *) (piclib ? 0 : minvma), 
 		maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0);
 	if (_dl_mmap_check_error(status)) {
-		_dl_dprintf(2, "%s: can't map '/dev/zero'\n", _dl_progname);
+		_dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname);
 		_dl_internal_error_number = DL_ERROR_MMAP_FAILED;
 		_dl_close(infile);
 		return NULL;

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor