diff options
-rw-r--r-- | ldso/ldso/boot1.c | 9 | ||||
-rw-r--r-- | ldso/ldso/hash.h | 18 | ||||
-rw-r--r-- | ldso/ldso/ld-uClibc.c | 9 | ||||
-rw-r--r-- | ldso/ldso/ld_hash.h | 18 | ||||
-rw-r--r-- | ldso/ldso/ld_string.h | 6 | ||||
-rw-r--r-- | ldso/ldso/ldso.c | 9 | ||||
-rw-r--r-- | ldso/ldso/string.h | 6 |
7 files changed, 49 insertions, 26 deletions
diff --git a/ldso/ldso/boot1.c b/ldso/ldso/boot1.c index 1da2b3466..c6dc5f628 100644 --- a/ldso/ldso/boot1.c +++ b/ldso/ldso/boot1.c @@ -219,11 +219,9 @@ void _dl_boot(unsigned int args) } #ifdef DL_DEBUG SEND_STDERR("ELF header ="); - SEND_STDERR(_dl_simple_ltoahex(load_addr)); - SEND_STDERR("\n"); + SEND_ADDRESS_STDERR(load_addr, 1); #endif - /* Locate the global offset table. Since this code must be PIC * we can take advantage of the magic offset register, if we * happen to know what that is for this architecture. If not, @@ -288,8 +286,7 @@ found_got: dpnt = (Elf32_Dyn *) (*got + load_addr); #ifdef DL_DEBUG SEND_STDERR("First Dynamic section entry="); - SEND_STDERR(_dl_simple_ltoahex((unsigned long)dpnt)); - SEND_STDERR("\n"); + SEND_ADDRESS_STDERR(dpnt, 1); #endif @@ -1012,7 +1009,7 @@ void *_dl_malloc(int size) #ifdef DL_DEBUG SEND_STDERR("malloc: request for "); - SEND_STDERR(_dl_simple_itoa(size)); + SEND_NUMBER_STDERR(size, 0); SEND_STDERR(" bytes\n"); #endif diff --git a/ldso/ldso/hash.h b/ldso/ldso/hash.h index cc1c56c42..c7fee6c97 100644 --- a/ldso/ldso/hash.h +++ b/ldso/ldso/hash.h @@ -82,6 +82,24 @@ extern int _dl_linux_dynamic_link(void); #else #define SEND_STDERR(X) _dl_write(2, X, _dl_strlen_inline(X)); #endif + +#define SEND_ADDRESS_STDERR(X, add_a_newline) { \ + char tmp[13]; \ + _dl_write(2, _dl_simple_ltoahex_inline( tmp, (unsigned long)(X)), 12); \ + if (add_a_newline) { \ + tmp[0]='\n'; \ + _dl_write(2, tmp, 1); \ + } \ +}; + +#define SEND_NUMBER_STDERR(X, add_a_newline) { \ + char tmp[13]; \ + _dl_write(2, (void *)_dl_simple_ltoahex_inline( tmp, (unsigned long)(X)), 12); \ + if (add_a_newline) { \ + tmp[0]='\n'; \ + _dl_write(2, tmp, 1); \ + } \ +}; extern int _dl_fdprintf(int, const char *, ...); extern char * _dl_library_path; extern char * _dl_not_lazy; diff --git a/ldso/ldso/ld-uClibc.c b/ldso/ldso/ld-uClibc.c index 1da2b3466..c6dc5f628 100644 --- a/ldso/ldso/ld-uClibc.c +++ b/ldso/ldso/ld-uClibc.c @@ -219,11 +219,9 @@ void _dl_boot(unsigned int args) } #ifdef DL_DEBUG SEND_STDERR("ELF header ="); - SEND_STDERR(_dl_simple_ltoahex(load_addr)); - SEND_STDERR("\n"); + SEND_ADDRESS_STDERR(load_addr, 1); #endif - /* Locate the global offset table. Since this code must be PIC * we can take advantage of the magic offset register, if we * happen to know what that is for this architecture. If not, @@ -288,8 +286,7 @@ found_got: dpnt = (Elf32_Dyn *) (*got + load_addr); #ifdef DL_DEBUG SEND_STDERR("First Dynamic section entry="); - SEND_STDERR(_dl_simple_ltoahex((unsigned long)dpnt)); - SEND_STDERR("\n"); + SEND_ADDRESS_STDERR(dpnt, 1); #endif @@ -1012,7 +1009,7 @@ void *_dl_malloc(int size) #ifdef DL_DEBUG SEND_STDERR("malloc: request for "); - SEND_STDERR(_dl_simple_itoa(size)); + SEND_NUMBER_STDERR(size, 0); SEND_STDERR(" bytes\n"); #endif diff --git a/ldso/ldso/ld_hash.h b/ldso/ldso/ld_hash.h index cc1c56c42..c7fee6c97 100644 --- a/ldso/ldso/ld_hash.h +++ b/ldso/ldso/ld_hash.h @@ -82,6 +82,24 @@ extern int _dl_linux_dynamic_link(void); #else #define SEND_STDERR(X) _dl_write(2, X, _dl_strlen_inline(X)); #endif + +#define SEND_ADDRESS_STDERR(X, add_a_newline) { \ + char tmp[13]; \ + _dl_write(2, _dl_simple_ltoahex_inline( tmp, (unsigned long)(X)), 12); \ + if (add_a_newline) { \ + tmp[0]='\n'; \ + _dl_write(2, tmp, 1); \ + } \ +}; + +#define SEND_NUMBER_STDERR(X, add_a_newline) { \ + char tmp[13]; \ + _dl_write(2, (void *)_dl_simple_ltoahex_inline( tmp, (unsigned long)(X)), 12); \ + if (add_a_newline) { \ + tmp[0]='\n'; \ + _dl_write(2, tmp, 1); \ + } \ +}; extern int _dl_fdprintf(int, const char *, ...); extern char * _dl_library_path; extern char * _dl_not_lazy; diff --git a/ldso/ldso/ld_string.h b/ldso/ldso/ld_string.h index 4a3462683..46de5320f 100644 --- a/ldso/ldso/ld_string.h +++ b/ldso/ldso/ld_string.h @@ -170,10 +170,9 @@ static inline char *_dl_get_last_path_component_inline(char *path) /* Early on, we can't call printf, so use this to print out * numbers using the SEND_STDERR() macro */ -static inline char *_dl_simple_ltoa_inline(unsigned long i) +static inline char *_dl_simple_ltoa_inline(char * local, unsigned long i) { /* 21 digits plus null terminator, good for 64-bit or smaller ints */ - static char local[22]; char *p = &local[21]; *p-- = '\0'; do { @@ -183,10 +182,9 @@ static inline char *_dl_simple_ltoa_inline(unsigned long i) return p + 1; } -static inline char *_dl_simple_ltoahex(unsigned long i) +static inline char *_dl_simple_ltoahex_inline(char * local, unsigned long i) { /* 21 digits plus null terminator, good for 64-bit or smaller ints */ - static char local[22]; char *p = &local[21]; *p-- = '\0'; do { diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 1da2b3466..c6dc5f628 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -219,11 +219,9 @@ void _dl_boot(unsigned int args) } #ifdef DL_DEBUG SEND_STDERR("ELF header ="); - SEND_STDERR(_dl_simple_ltoahex(load_addr)); - SEND_STDERR("\n"); + SEND_ADDRESS_STDERR(load_addr, 1); #endif - /* Locate the global offset table. Since this code must be PIC * we can take advantage of the magic offset register, if we * happen to know what that is for this architecture. If not, @@ -288,8 +286,7 @@ found_got: dpnt = (Elf32_Dyn *) (*got + load_addr); #ifdef DL_DEBUG SEND_STDERR("First Dynamic section entry="); - SEND_STDERR(_dl_simple_ltoahex((unsigned long)dpnt)); - SEND_STDERR("\n"); + SEND_ADDRESS_STDERR(dpnt, 1); #endif @@ -1012,7 +1009,7 @@ void *_dl_malloc(int size) #ifdef DL_DEBUG SEND_STDERR("malloc: request for "); - SEND_STDERR(_dl_simple_itoa(size)); + SEND_NUMBER_STDERR(size, 0); SEND_STDERR(" bytes\n"); #endif diff --git a/ldso/ldso/string.h b/ldso/ldso/string.h index 4a3462683..46de5320f 100644 --- a/ldso/ldso/string.h +++ b/ldso/ldso/string.h @@ -170,10 +170,9 @@ static inline char *_dl_get_last_path_component_inline(char *path) /* Early on, we can't call printf, so use this to print out * numbers using the SEND_STDERR() macro */ -static inline char *_dl_simple_ltoa_inline(unsigned long i) +static inline char *_dl_simple_ltoa_inline(char * local, unsigned long i) { /* 21 digits plus null terminator, good for 64-bit or smaller ints */ - static char local[22]; char *p = &local[21]; *p-- = '\0'; do { @@ -183,10 +182,9 @@ static inline char *_dl_simple_ltoa_inline(unsigned long i) return p + 1; } -static inline char *_dl_simple_ltoahex(unsigned long i) +static inline char *_dl_simple_ltoahex_inline(char * local, unsigned long i) { /* 21 digits plus null terminator, good for 64-bit or smaller ints */ - static char local[22]; char *p = &local[21]; *p-- = '\0'; do { |