This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix _dl_relocate_object for ELF_MACHINE_NO_PLT
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-alpha at sourceware dot org
- Date: Sun, 30 Jul 2006 15:02:39 +0000 (UTC)
- Subject: Fix _dl_relocate_object for ELF_MACHINE_NO_PLT
_dl_relocate_object should check ELF_MACHINE_NO_PLT before requiring
DL_PLTRELSZ to be present; fixed thus.
This fixes elf/tst-audit1 and elf/tst-audit2 on MIPS (the platform
defining ELF_MACHINE_NO_PLT).
2006-07-30 Joseph Myers <joseph@codesourcery.com>
* elf/dl-reloc.c (_dl_relocate_object): Do not try to allocate
array using DT_PLTRELSZ if ELF_MACHINE_NO_PLT.
Index: elf/dl-reloc.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-reloc.c,v
retrieving revision 1.101
diff -u -r1.101 dl-reloc.c
--- elf/dl-reloc.c 7 Jul 2005 02:24:54 -0000 1.101
+++ elf/dl-reloc.c 23 Jun 2006 01:59:15 -0000
@@ -274,6 +274,17 @@
relocations. If the shared object lacks a PLT (for example
if it only contains lead function) the l_info[DT_PLTRELSZ]
will be NULL. */
+#ifdef ELF_MACHINE_NO_PLT
+ l->l_reloc_result = calloc (sizeof (l->l_reloc_result[0]), 1);
+ if (l->l_reloc_result == NULL)
+ {
+ errstring = N_("\
+%s: out of memory to store relocation results for %s\n");
+ _dl_fatal_printf (errstring,
+ rtld_progname ?: "<program name unknown>",
+ l->l_name);
+ }
+#else
if (l->l_info[DT_PLTRELSZ] == NULL)
{
errstring = N_("%s: no PLTREL found in object %s\n");
@@ -291,6 +302,7 @@
%s: out of memory to store relocation results for %s\n");
goto fatal;
}
+#endif
}
#endif
}
--
Joseph S. Myers
joseph@codesourcery.com