aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-minimal.c13
-rw-r--r--elf/dl-version.c8
2 files changed, 15 insertions, 6 deletions
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index d83620d..12d38c9 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -1,5 +1,5 @@
/* Minimal replacements for basic facilities used in the dynamic linker.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997 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
@@ -77,6 +77,17 @@ malloc (size_t n)
return alloc_last_block;
}
+/* We use this function occasionally since the real implementation may
+ be optimized when it can assume the memory it returns already is
+ set to NUL. */
+void * weak_function
+calloc (size_t nmemb, size_t size)
+{
+ size_t total = nmemb * size;
+ void *result = malloc (total);
+ return memset (result, '\0', total);
+}
+
/* This will rarely be called. */
void weak_function
free (void *ptr)
diff --git a/elf/dl-version.c b/elf/dl-version.c
index 2a6f1b9..71eff0d 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -199,7 +199,7 @@ _dl_check_map_versions (struct link_map *map, int verbose)
aux->vna_flags & VER_FLG_WEAK);
/* Compare the version index. */
- if ((aux->vna_other & 0x7fff) > ndx_high)
+ if ((unsigned int) (aux->vna_other & 0x7fff) > ndx_high)
ndx_high = aux->vna_other & 0x7fff;
if (aux->vna_next == 0)
@@ -230,7 +230,7 @@ _dl_check_map_versions (struct link_map *map, int verbose)
ent = (ElfW(Verdef) *) (map->l_addr + def->d_un.d_ptr);
while (1)
{
- if ((ent->vd_ndx & 0x7fff) > ndx_high)
+ if ((unsigned int) (ent->vd_ndx & 0x7fff) > ndx_high)
ndx_high = ent->vd_ndx & 0x7fff;
if (ent->vd_next == 0)
@@ -247,9 +247,7 @@ _dl_check_map_versions (struct link_map *map, int verbose)
which can be indexed by the version index in the VERSYM
section. */
map->l_versions = (struct r_found_version *)
- malloc ((ndx_high + 1) * sizeof (*map->l_versions));
- memset (map->l_versions, '\0',
- (ndx_high + 1) * sizeof (*map->l_versions));
+ calloc (ndx_high + 1, sizeof (*map->l_versions));
if (map->l_versions == NULL)
{
_dl_signal_error (ENOMEM, (*map->l_name ? map->l_name : _dl_argv[0]),