summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-05-22 17:46:42 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-05-22 17:46:58 -0700
commit3e058c9d7eab6d6361e7cda5ba1394bc1757c9f6 (patch)
treeffd69b17e48ef749addd0e418b26c65ff84012f2 /elf
parent333e1ba4e53456a603621274177ae9393b9d5385 (diff)
downloadglibc-3e058c9d7eab6d6361e7cda5ba1394bc1757c9f6.tar.gz
glibc-3e058c9d7eab6d6361e7cda5ba1394bc1757c9f6.tar.xz
glibc-3e058c9d7eab6d6361e7cda5ba1394bc1757c9f6.zip
Don't issue an error if DT_PLTRELSZ is missing
A shared object doesn't need PLT if there are no PLT relocations.  It
shouldn't be an error if DT_PLTRELSZ is missing.

	[BZ #18410]
	* elf/dl-reloc.c (_dl_relocate_object): Don't issue an error
	for missing DT_PLTRELSZ.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-reloc.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 0872636f16..61252d7697 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -258,21 +258,13 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
     ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling, skip_ifunc);
 
 #ifndef PROF
-    if (__glibc_unlikely (consider_profiling))
+    if (__glibc_unlikely (consider_profiling)
+	&& l->l_info[DT_PLTRELSZ] != NULL)
       {
 	/* Allocate the array which will contain the already found
 	   relocations.  If the shared object lacks a PLT (for example
 	   if it only contains lead function) the l_info[DT_PLTRELSZ]
 	   will be NULL.  */
-	if (l->l_info[DT_PLTRELSZ] == NULL)
-	  {
-	    errstring = N_("%s: no PLTREL found in object %s\n");
-	  fatal:
-	    _dl_fatal_printf (errstring,
-			      RTLD_PROGNAME,
-			      l->l_name);
-	  }
-
 	size_t sizeofrel = l->l_info[DT_PLTREL]->d_un.d_val == DT_RELA
 			   ? sizeof (ElfW(Rela))
 			   : sizeof (ElfW(Rel));
@@ -283,7 +275,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 	  {
 	    errstring = N_("\
 %s: out of memory to store relocation results for %s\n");
-	    goto fatal;
+	    _dl_fatal_printf (errstring, RTLD_PROGNAME, l->l_name);
 	  }
       }
 #endif