From db0fb358ce066657ade7475e259afe7680f7e7a9 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 3 May 2001 15:56:13 +0000 Subject: Dont segfault when folks run ld-uclibc as an executable. --- ldso/ldso/boot1.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ldso/ldso/boot1.c') diff --git a/ldso/ldso/boot1.c b/ldso/ldso/boot1.c index 127b9d9ff..b9eb5cabf 100644 --- a/ldso/ldso/boot1.c +++ b/ldso/ldso/boot1.c @@ -126,7 +126,7 @@ static char *_dl_malloc_addr, *_dl_mmap_zero; char *_dl_library_path = 0; /* Where we look for libraries */ char *_dl_preload = 0; /* Things to be loaded before the libs. */ -char *_dl_progname = "/lib/ld-linux-uclibc.so.1"; +char *_dl_progname = "ld-linux-uclibc.so.0"; static char *_dl_not_lazy = 0; static char *_dl_warn = 0; /* Used by ldd */ static char *_dl_trace_loaded_objects = 0; @@ -210,12 +210,22 @@ void _dl_boot(unsigned int args) /* Next, locate the GOT */ load_addr = auxv_t[AT_BASE].a_un.a_val; + if (load_addr == 0x0) { + /* Looks like they decided to run ld-linux-uclibc.so as + * an executable. Exit gracefully for now. */ + + /* TODO -- actually accept executables and args to run... */ + //SEND_STDERR("Usage: ld.so EXECUTABLE [ARGS...]\n"); + SEND_STDERR("You have run `ld.so', the helper program for shared\n"); + SEND_STDERR("library executables. You probably did not intend to\n"); + SEND_STDERR("run this program. Goodbye.\n\n"); + _dl_exit(0); + } #ifdef DL_DEBUG SEND_STDERR("load_addr="); SEND_STDERR(_dl_simple_ltoahex(load_addr)); SEND_STDERR("\n"); #endif -// __asm__("\tmovl %%ebx,%0\n\t" : "=a" (X)) GET_GOT(got); #ifdef DL_DEBUG SEND_STDERR("Found got="); -- cgit v1.2.3