浏览代码

A few more little fixups

Eric Andersen 22 年之前
父节点
当前提交
265e399393
共有 2 个文件被更改,包括 18 次插入23 次删除
  1. 9 22
      ldso/ldso/ld_string.h
  2. 9 1
      ldso/ldso/ldso.c

+ 9 - 22
ldso/ldso/ld_string.h

@@ -224,30 +224,17 @@ 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 *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);	\
-}
+#define SEND_STDERR(X)				\
+  { const char *__s = (X);			\
+    if (__s < (const char *) load_addr) __s += load_addr;	\
+    _dl_write (2, __s, _dl_strlen (__s));	\
+  }
 #else
-#define SEND_STDERR(str)		\
-{					\
-    register char *ptr = (char *) str;	\
-    while (*ptr)			\
-	ptr++;				\
-    _dl_write(2, str, ptr - str);	\
-}
+#define SEND_STDERR(X) _dl_write(2, X, _dl_strlen(X));
 #endif
 
 #define SEND_ADDRESS_STDERR(X, add_a_newline) { \
-    char tmp[22], *tmp1; \
+    char tmp[13], *tmp1; \
     _dl_memset(tmp, 0, sizeof(tmp)); \
     tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen(tmp1)); \
@@ -258,9 +245,9 @@ static inline char *_dl_simple_ltoahex(char * local, unsigned long i)
 };
 
 #define SEND_NUMBER_STDERR(X, add_a_newline) { \
-    char tmp[22], *tmp1; \
+    char tmp[13], *tmp1; \
     _dl_memset(tmp, 0, sizeof(tmp)); \
-    tmp1=_dl_simple_ltoa( tmp, (unsigned long)(X)); \
+    tmp1=_dl_simple_ltoahex( tmp, (unsigned long)(X)); \
     _dl_write(2, tmp1, _dl_strlen(tmp1)); \
     if (add_a_newline) { \
 	tmp[0]='\n'; \

+ 9 - 1
ldso/ldso/ldso.c

@@ -447,9 +447,12 @@ DL_BOOT(unsigned long args)
 	}
 #endif
 
+
 	/* OK, now do the relocations.  We do not do a lazy binding here, so
 	   that once we are done, we have considerably more flexibility. */
-
+#ifdef DL_DEBUG
+	SEND_STDERR("About to do library loader relocations.\n");
+#endif
 	goof = 0;
 	for (indx = 0; indx < 2; indx++) {
 		int i;
@@ -505,6 +508,11 @@ DL_BOOT(unsigned long args)
 					SEND_STDERR(" undefined.\n");
 					goof++;
 				}
+#ifdef DL_DEBUG
+				SEND_STDERR("About to fixup symbol: ");
+				SEND_STDERR(strtab + symtab[symtab_index].st_name);
+				SEND_STDERR("\n");
+#endif  
 			}
 			/*
 			 * Use this machine-specific macro to perform the actual relocation.