diff options
| -rw-r--r-- | ldso/include/ldso.h | 14 | ||||
| -rw-r--r-- | ldso/ldso/arm/elfinterp.c | 4 | ||||
| -rw-r--r-- | ldso/ldso/dl-elf.c | 6 | ||||
| -rw-r--r-- | ldso/ldso/dl-tls.c | 3 | ||||
| -rw-r--r-- | ldso/ldso/ldso.c | 22 | ||||
| -rw-r--r-- | ldso/ldso/m68k/elfinterp.c | 5 | ||||
| -rw-r--r-- | ldso/ldso/sparc/elfinterp.c | 5 | 
7 files changed, 39 insertions, 20 deletions
| diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index fc356b0e3..f5bb6e077 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -113,7 +113,8 @@ extern int   _dl_debug_file;  #else  # define __dl_debug_dprint(fmt, args...) do {} while (0)  # define _dl_if_debug_dprint(fmt, args...) do {} while (0) -# define _dl_debug_file 2 +/* disabled on purpose, _dl_debug_file should be guarded by __SUPPORT_LD_DEBUG__ +# define _dl_debug_file 2*/  #endif /* __SUPPORT_LD_DEBUG__ */  #ifdef IS_IN_rtld @@ -149,8 +150,19 @@ extern void *_dl_realloc(void *__ptr, size_t __size);  extern void _dl_free(void *);  extern char *_dl_getenv(const char *symbol, char **envp);  extern void _dl_unsetenv(const char *symbol, char **envp); +#ifdef IS_IN_rtld  extern char *_dl_strdup(const char *string);  extern void _dl_dprintf(int, const char *, ...); +#else +# include <string.h> +# define _dl_strdup strdup +# include <stdio.h> +# ifdef __USE_GNU +#  define _dl_dprintf dprintf +# else +#  define _dl_dprintf(fd, fmt, args...) fprintf(stderr, fmt, ## args) +# endif +#endif  #ifndef DL_GET_READY_TO_RUN_EXTRA_PARMS  # define DL_GET_READY_TO_RUN_EXTRA_PARMS diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c index b6dfae26b..c2f52b822 100644 --- a/ldso/ldso/arm/elfinterp.c +++ b/ldso/ldso/arm/elfinterp.c @@ -77,9 +77,9 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)  		_dl_exit(1);  	}  #if defined (__SUPPORT_LD_DEBUG__) -#if !defined __SUPPORT_LD_DEBUG_EARLY__ +# if !defined __SUPPORT_LD_DEBUG_EARLY__  	if ((unsigned long) got_addr < 0x40000000) -#endif +# endif  	{  		if (_dl_debug_bindings)  		{ diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 31ba11ffa..55ff31e4f 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -739,7 +739,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned rflags,  			}  		}  #else -		_dl_dprintf(_dl_debug_file, "Can't modify %s's text section." +		_dl_dprintf(2, "Can't modify %s's text section."  			" Use GCC option -fPIC for shared objects, please.\n",  			libname);  		_dl_exit(1); @@ -1004,6 +1004,7 @@ int _dl_fixup(struct dyn_elf *rpnt, struct r_scope_elem *scope, int now_flag)  	return goof;  } +#ifdef IS_IN_rtld  /* Minimal printf which handles only %s, %d, and %x */  void _dl_dprintf(int fd, const char *fmt, ...)  { @@ -1069,7 +1070,7 @@ void _dl_dprintf(int fd, const char *fmt, ...)  						break;  					}  				case 'x': -				case 'X': +				case 'p':  					{  						char tmp[22];  #if __WORDSIZE > 32 @@ -1106,6 +1107,7 @@ char *_dl_strdup(const char *string)  	_dl_strcpy(retval, string);  	return retval;  } +#endif  unsigned int _dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[],                                      void *debug_addr, DL_LOADADDR_TYPE load_off) diff --git a/ldso/ldso/dl-tls.c b/ldso/ldso/dl-tls.c index a672e748d..6679693f4 100644 --- a/ldso/ldso/dl-tls.c +++ b/ldso/ldso/dl-tls.c @@ -922,8 +922,7 @@ _dl_add_to_slotinfo (struct link_map  *l)  	     generation.  */  	  ++_dl_tls_generation; -	  _dl_dprintf (_dl_debug_file, -			"cannot create TLS data structures: ABORT\n"); +	  _dl_dprintf(2, "cannot create TLS data structures: ABORT\n");  	  _dl_exit (127);  	} diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index d3891e269..becabd39b 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -241,7 +241,7 @@ void *_dl_malloc(size_t size)  		_dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, rounded_size,  				PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_UNINITIALIZE, -1, 0);  		if (_dl_mmap_check_error(_dl_mmap_zero)) { -			_dl_dprintf(_dl_debug_file, "%s: mmap of a spare page failed!\n", _dl_progname); +			_dl_dprintf(2, "%s: mmap of a spare page failed!\n", _dl_progname);  			_dl_exit(20);  		}  	} @@ -465,7 +465,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,  #ifndef __LDSO_STANDALONE_SUPPORT__  	if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) { -		_dl_dprintf(_dl_debug_file, "Standalone execution is not enabled\n"); +		_dl_dprintf(2, "Standalone execution is not enabled\n");  		_dl_exit(1);  	}  #endif @@ -579,7 +579,7 @@ of this helper program; chances are you did not intend to run this program.\n\  		 */  		app_tpnt = _dl_load_elf_shared_library(_dl_secure, &rpnt, _dl_progname);  		if (!app_tpnt) { -			_dl_dprintf(_dl_debug_file, "can't load '%s'\n", _dl_progname); +			_dl_dprintf(2, "can't load '%s'\n", _dl_progname);  			_dl_exit(16);  		}  		/* @@ -674,7 +674,7 @@ of this helper program; chances are you did not intend to run this program.\n\  			}  #else  			if (app_tpnt->dynamic_info[DT_TEXTREL]) { -				_dl_dprintf(_dl_debug_file, "Can't modify application's text section; use the GCC option -fPIE for position-independent executables.\n"); +				_dl_dprintf(2, "Can't modify application's text section; use the GCC option -fPIE for position-independent executables.\n");  				_dl_exit(1);  			}  #endif @@ -737,7 +737,7 @@ of this helper program; chances are you did not intend to run this program.\n\  			_dl_debug_early("Found TLS header for application program\n");  			break;  #else -			_dl_dprintf(_dl_debug_file, "Program uses unsupported TLS data!\n"); +			_dl_dprintf(2, "Program uses unsupported TLS data!\n");  			_dl_exit(1);  #endif  		} @@ -827,7 +827,7 @@ of this helper program; chances are you did not intend to run this program.\n\  #ifndef __LDSO_LDD_SUPPORT__  	if (trace_loaded_objects) { -		_dl_dprintf(_dl_debug_file, "Use the ldd provided by uClibc\n"); +		_dl_dprintf(2, "Use the ldd provided by uClibc\n");  		_dl_exit(1);  	}  #endif @@ -883,7 +883,7 @@ of this helper program; chances are you did not intend to run this program.\n\  					else  #endif  					{ -						_dl_dprintf(_dl_debug_file, "%s: library '%s' " +						_dl_dprintf(2, "%s: library '%s' "  							"from LD_PRELOAD can't be preloaded: ignored.\n",  							_dl_progname, str);  					} @@ -928,7 +928,7 @@ of this helper program; chances are you did not intend to run this program.\n\  		}  		if ((fd = _dl_open(LDSO_PRELOAD, O_RDONLY, 0)) < 0) { -			_dl_dprintf(_dl_debug_file, "%s: can't open file '%s'\n", +			_dl_dprintf(2, "%s: can't open file '%s'\n",  				    _dl_progname, LDSO_PRELOAD);  			break;  		} @@ -937,7 +937,7 @@ of this helper program; chances are you did not intend to run this program.\n\  					     PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);  		_dl_close(fd);  		if (preload == (caddr_t) -1) { -			_dl_dprintf(_dl_debug_file, "%s:%i: can't map '%s'\n", +			_dl_dprintf(2, "%s:%i: can't map '%s'\n",  				    _dl_progname, __LINE__, LDSO_PRELOAD);  			break;  		} @@ -976,7 +976,7 @@ of this helper program; chances are you did not intend to run this program.\n\  				else  # endif  				{ -					_dl_dprintf(_dl_debug_file, "%s: can't load library '%s'\n", _dl_progname, cp2); +					_dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, cp2);  					_dl_exit(15);  				}  			} else { @@ -1037,7 +1037,7 @@ of this helper program; chances are you did not intend to run this program.\n\  					} else  #endif  					{ -						_dl_dprintf(_dl_debug_file, "%s: can't load library '%s'\n", _dl_progname, lpntstr); +						_dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, lpntstr);  						_dl_exit(16);  					}  				} diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c index 4e8714246..fd7fe8513 100644 --- a/ldso/ldso/m68k/elfinterp.c +++ b/ldso/ldso/m68k/elfinterp.c @@ -241,8 +241,11 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,  				_dl_memcpy ((void *) reloc_addr,  				            (void *) symbol_addr,  				            sym_ref.sym->st_size); -			} else +			} +#if defined (__SUPPORT_LD_DEBUG__) +			else  				_dl_dprintf(_dl_debug_file, "no symbol_addr to copy !?\n"); +#endif  			break;  		default: diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c index e3f0e470a..bb61be9eb 100644 --- a/ldso/ldso/sparc/elfinterp.c +++ b/ldso/ldso/sparc/elfinterp.c @@ -275,8 +275,11 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,  				_dl_memcpy((char *)reloc_addr,  					   (char *)symbol_addr,  					   sym_ref.sym->st_size); -			} else +			} +#if defined (__SUPPORT_LD_DEBUG__) +			else  				_dl_dprintf(_dl_debug_file, "no symbol_addr to copy !?\n"); +#endif  			break;  #if defined USE_TLS && USE_TLS  		case R_SPARC_TLS_DTPMOD32: | 
