aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-07 16:28:09 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-07 16:28:09 +0000
commit27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7 (patch)
treed91c99e57babfeaf64a8d686fdadd935a0c50866 /elf
parent6ca96fe202d5031bd34794b81798651a07839075 (diff)
downloadglibc-27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7.zip
glibc-27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7.tar.gz
glibc-27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7.tar.bz2
Update.
1998-04-07 16:18 Ulrich Drepper <drepper@cygnus.com> * libc.map: Add __asprintf to GLIBC_2.1. * elf/dlerror.c: Use __asprintf, not asprintf. * libio/stdio.h: Declare __asprintf. * stdio-common/asprintf.c: Define as __asprintf and make asprintf a weak alias. * elf/dl-minimal.c: Add definition of strtol and strtoul (und friends) to avoid inclusion from libc_pic.a. * elf/dl-runtime.c: Undo last patch. * stdlib/strtod.c: Don't use mbtowc, use btowc. * sysdeps/i386/dl-machine.h (dl_platform_init): Don't use "i386" as default, use NULL.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-minimal.c127
-rw-r--r--elf/dl-runtime.c8
-rw-r--r--elf/dlerror.c4
3 files changed, 133 insertions, 6 deletions
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index 6592ca0..4c15d83 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -18,6 +18,7 @@
Boston, MA 02111-1307, USA. */
#include <errno.h>
+#include <limits.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
@@ -202,3 +203,129 @@ __assert_perror_fail (int errnum,
}
#endif
+
+/* This function is only used in eval.c. */
+long int
+weak_function
+__strtol_internal (const char *nptr, char **endptr, int base, int group)
+{
+ long int result = 0;
+ long int sign = 1;
+
+ while (*nptr == ' ' || *nptr == '\t')
+ ++nptr;
+
+ if (*nptr == '-')
+ {
+ sign = -1;
+ ++nptr;
+ }
+ else if (*nptr == '+')
+ ++nptr;
+
+ if (*nptr < '0' || *nptr > '9')
+ {
+ if (endptr != NULL)
+ *endptr = (char *) nptr;
+ return 0L;
+ }
+
+ assert (base == 0);
+ if (*nptr == '0')
+ {
+ if (nptr[1] == 'x' || nptr[1] == 'X')
+ {
+ base = 16;
+ nptr += 2;
+ }
+ else
+ base = 8;
+ }
+ else
+ base = 10;
+
+ while (*nptr >= '0' && *nptr <= '9')
+ {
+ long int digval = *nptr - '0';
+ if (result > LONG_MAX / 10
+ || (result == (sign ? LONG_MAX : LONG_MAX + 1) / 10
+ && digval > (sign ? LONG_MAX : LONG_MAX + 1) % 10))
+ {
+ errno = ERANGE;
+ return LONG_MAX * sign;
+ }
+ result *= 10;
+ result += digval;
+ }
+
+ return result * sign;
+}
+
+long int
+weak_function
+strtol (const char *nptr, char **endptr, int base)
+{
+ return __strtol_internal (nptr, endptr, base, 0);
+}
+
+unsigned long int
+weak_function
+__strtoul_internal (const char *nptr, char **endptr, int base, int group)
+{
+ long int result = 0;
+ long int sign = 1;
+
+ while (*nptr == ' ' || *nptr == '\t')
+ ++nptr;
+
+ if (*nptr == '-')
+ {
+ sign = -1;
+ ++nptr;
+ }
+ else if (*nptr == '+')
+ ++nptr;
+
+ if (*nptr < '0' || *nptr > '9')
+ {
+ if (endptr != NULL)
+ *endptr = (char *) nptr;
+ return 0UL;
+ }
+
+ assert (base == 0);
+ if (*nptr == '0')
+ {
+ if (nptr[1] == 'x' || nptr[1] == 'X')
+ {
+ base = 16;
+ nptr += 2;
+ }
+ else
+ base = 8;
+ }
+ else
+ base = 10;
+
+ while (*nptr >= '0' && *nptr <= '9')
+ {
+ long int digval = *nptr - '0';
+ if (result > LONG_MAX / 10
+ || (result == ULONG_MAX / 10 && digval > ULONG_MAX % 10))
+ {
+ errno = ERANGE;
+ return ULONG_MAX;
+ }
+ result *= 10;
+ result += digval;
+ }
+
+ return result * sign;
+}
+
+unsigned long int
+weak_function
+strtoul (const char *nptr, char **endptr, int base)
+{
+ return (unsigned long int) __strtoul_internal (nptr, endptr, base, 0);
+}
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index 10daa98..53601b8 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -128,13 +128,13 @@ fixup (
{
value = _dl_lookup_versioned_symbol(strtab + sym->st_name,
&sym, scope, l->l_name,
- version, DL_LOOKUP_NOPLT);
+ version, ELF_MACHINE_JMP_SLOT);
break;
}
}
case 0:
value = _dl_lookup_symbol (strtab + sym->st_name, &sym, scope,
- l->l_name, DL_LOOKUP_NOPLT);
+ l->l_name, ELF_MACHINE_JMP_SLOT);
}
/* Currently value contains the base load address of the object
@@ -205,13 +205,13 @@ profile_fixup (
value = _dl_lookup_versioned_symbol(strtab + sym->st_name,
&sym, scope, l->l_name,
version,
- DL_LOOKUP_NOPLT);
+ ELF_MACHINE_JMP_SLOT);
break;
}
}
case 0:
value = _dl_lookup_symbol (strtab + sym->st_name, &sym, scope,
- l->l_name, DL_LOOKUP_NOPLT);
+ l->l_name, ELF_MACHINE_JMP_SLOT);
}
/* Currently value contains the base load address of the object
diff --git a/elf/dlerror.c b/elf/dlerror.c
index 00d367b..ba25611 100644
--- a/elf/dlerror.c
+++ b/elf/dlerror.c
@@ -72,8 +72,8 @@ dlerror (void)
buf = result->errstring;
else
{
- if (asprintf (&buf, "%s: %s",
- result->errstring, strerror (result->errcode)) == -1)
+ if (__asprintf (&buf, "%s: %s",
+ result->errstring, strerror (result->errcode)) == -1)
buf = NULL;
/* We don't need the error string anymore. */