mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
Provide __libc_fatal for rtld.
This commit is contained in:
@ -1,5 +1,10 @@
|
|||||||
2015-07-09 Roland McGrath <roland@hack.frob.com>
|
2015-07-09 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* include/stdio.h: Add rtld_hidden_proto (__libc_fatal).
|
||||||
|
* elf/dl-minimal.c: For readability, reorder some definitions and
|
||||||
|
introduce more page breaks. Include <stdio.h>.
|
||||||
|
(__libc_fatal): New function.
|
||||||
|
|
||||||
* include/unistd.h: Add rtld_hidden_proto for _exit.
|
* include/unistd.h: Add rtld_hidden_proto for _exit.
|
||||||
* posix/_exit.c: Add rtld_hidden_def.
|
* posix/_exit.c: Add rtld_hidden_def.
|
||||||
* sysdeps/mach/hurd/_exit.c: Likewise.
|
* sysdeps/mach/hurd/_exit.c: Likewise.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -193,8 +194,22 @@ __strerror_r (int errnum, char *buf, size_t buflen)
|
|||||||
return msg;
|
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.
|
/* 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
|
If we are linked into the user program (-ldl), the normal __assert_fail
|
||||||
defn can override this one. */
|
defn can override this one. */
|
||||||
@ -209,7 +224,7 @@ Inconsistency detected by ld.so: %s: %u: %s%sAssertion `%s' failed!\n",
|
|||||||
assertion);
|
assertion);
|
||||||
|
|
||||||
}
|
}
|
||||||
rtld_hidden_weak(__assert_fail)
|
rtld_hidden_weak (__assert_fail)
|
||||||
|
|
||||||
void weak_function
|
void weak_function
|
||||||
__assert_perror_fail (int errnum,
|
__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)
|
rtld_hidden_weak (__assert_perror_fail)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned long int weak_function
|
unsigned long int weak_function
|
||||||
__strtoul_internal (const char *nptr, char **endptr, int base, int group)
|
__strtoul_internal (const char *nptr, char **endptr, int base, int group)
|
||||||
{
|
{
|
||||||
@ -324,7 +339,11 @@ _itoa (value, buflim, base, upper_case)
|
|||||||
return buflim;
|
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
|
/* The following is not a complete strsep implementation. It cannot
|
||||||
handle empty delimiter strings. But this isn't necessary for the
|
handle empty delimiter strings. But this isn't necessary for the
|
||||||
execution of ld.so. */
|
execution of ld.so. */
|
||||||
@ -367,16 +386,3 @@ __strsep (char **stringp, const char *delim)
|
|||||||
}
|
}
|
||||||
weak_alias (__strsep, strsep)
|
weak_alias (__strsep, strsep)
|
||||||
strong_alias (__strsep, __strsep_g)
|
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)
|
|
||||||
|
@ -172,6 +172,7 @@ libc_hidden_proto (fmemopen)
|
|||||||
extern FILE *__open_memstream (char **, size_t *) __THROW __wur;
|
extern FILE *__open_memstream (char **, size_t *) __THROW __wur;
|
||||||
libc_hidden_proto (__open_memstream)
|
libc_hidden_proto (__open_memstream)
|
||||||
libc_hidden_proto (__libc_fatal)
|
libc_hidden_proto (__libc_fatal)
|
||||||
|
rtld_hidden_proto (__libc_fatal)
|
||||||
libc_hidden_proto (__vsprintf_chk)
|
libc_hidden_proto (__vsprintf_chk)
|
||||||
libc_hidden_proto (__vsnprintf_chk)
|
libc_hidden_proto (__vsnprintf_chk)
|
||||||
libc_hidden_proto (__vfprintf_chk)
|
libc_hidden_proto (__vfprintf_chk)
|
||||||
|
Reference in New Issue
Block a user