summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2015-07-09 15:32:32 -0700
committerRoland McGrath <roland@hack.frob.com>2015-07-09 15:32:32 -0700
commit2193ce8746ec11b2325cc55aa8f338d5872492bf (patch)
tree3f3ffa2d01ce901913f5df9c38924f0a216ed8d3 /elf
parentaf85d409a29ae435949a7fcc7065d88af0233d24 (diff)
downloadglibc-2193ce8746ec11b2325cc55aa8f338d5872492bf.tar.gz
Provide __libc_fatal for rtld.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-minimal.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index 04f416dced..ec7fe88d30 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <limits.h>
+#include <stdio.h>
#include <string.h>
#include <tls.h>
#include <unistd.h>
@@ -193,8 +194,22 @@ __strerror_r (int errnum, char *buf, size_t buflen)
return msg;
}
-#ifndef NDEBUG
+void
+__libc_fatal (const char *message)
+{
+ _dl_fatal_printf ("%s", message);
+}
+rtld_hidden_def (__libc_fatal)
+void
+__attribute__ ((noreturn))
+__chk_fail (void)
+{
+ _exit (127);
+}
+rtld_hidden_def (__chk_fail)
+
+#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. */
@@ -209,7 +224,7 @@ Inconsistency detected by ld.so: %s: %u: %s%sAssertion `%s' failed!\n",
assertion);
}
-rtld_hidden_weak(__assert_fail)
+rtld_hidden_weak (__assert_fail)
void weak_function
__assert_perror_fail (int errnum,
@@ -225,7 +240,7 @@ Inconsistency detected by ld.so: %s: %u: %s%sUnexpected error: %s.\n",
}
rtld_hidden_weak (__assert_perror_fail)
#endif
-
+
unsigned long int weak_function
__strtoul_internal (const char *nptr, char **endptr, int base, int group)
{
@@ -324,7 +339,11 @@ _itoa (value, buflim, base, upper_case)
return buflim;
}
-
+/* The '_itoa_lower_digits' variable in libc.so is able to handle bases
+ up to 36. We don't need this here. */
+const char _itoa_lower_digits[16] = "0123456789abcdef";
+rtld_hidden_data_def (_itoa_lower_digits)
+
/* The following is not a complete strsep implementation. It cannot
handle empty delimiter strings. But this isn't necessary for the
execution of ld.so. */
@@ -367,16 +386,3 @@ __strsep (char **stringp, const char *delim)
}
weak_alias (__strsep, strsep)
strong_alias (__strsep, __strsep_g)
-
-void
-__attribute__ ((noreturn))
-__chk_fail (void)
-{
- _exit (127);
-}
-rtld_hidden_def (__chk_fail)
-
-/* The '_itoa_lower_digits' variable in libc.so is able to handle bases
- up to 36. We don't need this here. */
-const char _itoa_lower_digits[16] = "0123456789abcdef";
-rtld_hidden_data_def (_itoa_lower_digits)