]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - elf/dl-minimal.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / elf / dl-minimal.c
index 4a97f56faad327d55ca15821ecbea66135a938b8..762e65b4d079f71f0b477560d4414730c86458c8 100644 (file)
@@ -1,5 +1,5 @@
 /* Minimal replacements for basic facilities used in the dynamic linker.
-   Copyright (C) 1995-2012 Free Software Foundation, Inc.
+   Copyright (C) 1995-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
 
 #include <errno.h>
 #include <limits.h>
+#include <stdio.h>
 #include <string.h>
 #include <tls.h>
 #include <unistd.h>
@@ -68,7 +69,7 @@ __libc_memalign (size_t align, size_t n)
       /* Insufficient space left; allocate another page.  */
       caddr_t page;
       size_t nup = (n + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
-      if (__builtin_expect (nup == 0, 0))
+      if (__glibc_unlikely (nup == 0))
        {
          if (n)
            return NULL;
@@ -193,8 +194,22 @@ __strerror_r (int errnum, char *buf, size_t buflen)
   return msg;
 }
 \f
-#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
-
+\f
 unsigned long int weak_function
 __strtoul_internal (const char *nptr, char **endptr, int base, int group)
 {
@@ -309,24 +324,23 @@ __strtoul_internal (const char *nptr, char **endptr, int base, int group)
    also has to be present and it is never about speed when these
    functions are used.  */
 char *
-_itoa (value, buflim, base, upper_case)
-     unsigned long long int value;
-     char *buflim;
-     unsigned int base;
-     int upper_case;
+_itoa (unsigned long long int value, char *buflim, unsigned int base,
+       int upper_case)
 {
-  extern const char INTUSE(_itoa_lower_digits)[] attribute_hidden;
-
   assert (! upper_case);
 
   do
-    *--buflim = INTUSE(_itoa_lower_digits)[value % base];
+    *--buflim = _itoa_lower_digits[value % base];
   while ((value /= base) != 0);
 
   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)
+\f
 /* 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.  */
@@ -369,16 +383,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 INTUSE(_itoa_lower_digits)[16] attribute_hidden
-  = "0123456789abcdef";