summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-error.c1
-rw-r--r--elf/dlsym.c2
-rw-r--r--elf/elf.h2
-rw-r--r--elf/rtld.c24
4 files changed, 27 insertions, 2 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 5f8e4e4088..acb21a0414 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -30,6 +30,7 @@ _dl_signal_error (int errcode,
 		  const char *errstring)
 {
   signalled_errstring = errstring ?: "DYNAMIC LINKER BUG!!!";
+  signalled_objname = objname;
   longjmp (catch_env, errcode ?: -1);
 }
 
diff --git a/elf/dlsym.c b/elf/dlsym.c
index 3e10812da8..dbd617ec9a 100644
--- a/elf/dlsym.c
+++ b/elf/dlsym.c
@@ -33,7 +33,7 @@ dlsym (void *handle, const char *name)
   void doit (void)
     {
       const Elf32_Sym *ref = NULL;
-      value = _dl_lookup_symbol (name, map->l_name, &ref, map);
+      value = _dl_lookup_symbol (name, &ref, map, map->l_name);
     }
 
   /* Confine the symbol scope to just this map.  */
diff --git a/elf/elf.h b/elf/elf.h
index 40c0cd8aab..433aa479e7 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -545,7 +545,7 @@ typedef struct
 
 /* Legal values for p_type field of Elf32_Phdr.  */
 
-#define PT_MIPS_REGINFO	0x70000000	/* Regiser usage information */
+#define PT_MIPS_REGINFO	0x70000000	/* Register usage information */
 
 /* Legal values for d_tag field of Elf32_Dyn.  */
 
diff --git a/elf/rtld.c b/elf/rtld.c
index 0605336603..85f258a948 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -261,3 +261,27 @@ void
 _dl_r_debug_state (void)
 {
 }
+
+#ifndef NDEBUG
+
+/* Define (weakly) our own assert failure function which doesn't use stdio.
+   If we are linked into the user program (-ldl), the normal __assert_fail
+   defn can override this one.  */
+
+#include "../stdio/_itoa.h"
+
+void
+__assert_fail (const char *assertion,
+	       const char *file, unsigned int line, const char *function)
+{
+  char buf[64];
+  buf[sizeof buf - 1] = '\0';
+  _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
+		    file, ": ", _itoa (line, buf + sizeof buf - 1, 10, 0),
+		    ": ", function ?: "", function ? ": " : "",
+		    "Assertion `", assertion, "' failed!\n");
+
+}
+weak_symbol (__assert_fail)
+
+#endif