aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-reloc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-04 09:53:17 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-04 09:53:17 +0000
commitea7eb7e3eb09a7f9444e0c599fdbafaadb3e391d (patch)
tree0d80af9968048e23bd0781ee7b9759c9af27235d /elf/dl-reloc.c
parentf6d8a525ef354f5903f81d20ed879935c633aafd (diff)
downloadglibc-ea7eb7e3eb09a7f9444e0c599fdbafaadb3e391d.tar
glibc-ea7eb7e3eb09a7f9444e0c599fdbafaadb3e391d.tar.gz
glibc-ea7eb7e3eb09a7f9444e0c599fdbafaadb3e391d.tar.bz2
glibc-ea7eb7e3eb09a7f9444e0c599fdbafaadb3e391d.zip
Update.
1998-03-04 09:43 Ulrich Drepper <drepper@cygnus.com> * elf/link.h (struct link_map): Add new field l_reloc_result. * elf/dl-reloc.c (_dl_relocate_object): Allocate array for results of relocation for the object to be profiled. * elf/dl-object.c (_dl_new_object): Initialize l_reloc_result field to NULL. * elf/rtld.c (_dl_start): Add comment that we must not allocate an array here. * elf/dl-runtime.c (profile_fixup): If l_reloc_result array already contains a result from a previous run use this instead of computing the value again. * elf/dl-minimal.c (malloc): Remove limit for size of allocation. 1998-03-04 11:32 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Diffstat (limited to 'elf/dl-reloc.c')
-rw-r--r--elf/dl-reloc.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 4f6eff8835..531da9618a 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -1,5 +1,5 @@
/* Relocate a shared object and resolve its references to other loaded objects.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 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
@@ -17,11 +17,12 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <errno.h>
#include <link.h>
-#include <sys/types.h>
-#include <sys/mman.h>
+#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
+#include <sys/mman.h>
+#include <sys/types.h>
#include "dynamic-link.h"
@@ -67,6 +68,18 @@ _dl_relocate_object (struct link_map *l, struct link_map *scope[], int lazy)
#include "dynamic-link.h"
ELF_DYNAMIC_RELOCATE (l, lazy, 1);
+
+ if (_dl_profile_map == l)
+ {
+ /* Allocate the array which will contain the already found
+ relocations. */
+ l->l_reloc_result =
+ (ElfW(Addr) *) calloc (sizeof (ElfW(Addr)),
+ l->l_info[DT_PLTRELSZ]->d_un.d_val);
+ if (l->l_reloc_result == NULL)
+ _dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
+ "cannot allocate memory for profiling", NULL);
+ }
}
/* Mark the object so we know this work has been done. */