fa3bfd
commit 3e058c9d7eab6d6361e7cda5ba1394bc1757c9f6
fa3bfd
Author: H.J. Lu <hjl.tools@gmail.com>
fa3bfd
Date:   Fri May 22 17:46:42 2015 -0700
fa3bfd
fa3bfd
    Don't issue an error if DT_PLTRELSZ is missing
fa3bfd
    
fa3bfd
    A shared object doesn't need PLT if there are no PLT relocations.  It
fa3bfd
    shouldn't be an error if DT_PLTRELSZ is missing.
fa3bfd
    
fa3bfd
    	[BZ #18410]
fa3bfd
    	* elf/dl-reloc.c (_dl_relocate_object): Don't issue an error
fa3bfd
    	for missing DT_PLTRELSZ.
fa3bfd
fa3bfd
diff -rup a/elf/dl-reloc.c b/elf/dl-reloc.c
fa3bfd
--- a/elf/dl-reloc.c	2017-10-04 16:42:16.000000000 -0400
fa3bfd
+++ b/elf/dl-reloc.c	2017-10-05 17:44:14.486358084 -0400
fa3bfd
@@ -259,21 +259,13 @@ _dl_relocate_object (struct link_map *l,
fa3bfd
     ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling, skip_ifunc);
fa3bfd
 
fa3bfd
 #ifndef PROF
fa3bfd
-    if (__builtin_expect (consider_profiling, 0))
fa3bfd
+    if (__builtin_expect (consider_profiling, 0)
fa3bfd
+	&& l->l_info[DT_PLTRELSZ] != NULL)
fa3bfd
       {
fa3bfd
 	/* Allocate the array which will contain the already found
fa3bfd
 	   relocations.  If the shared object lacks a PLT (for example
fa3bfd
 	   if it only contains lead function) the l_info[DT_PLTRELSZ]
fa3bfd
 	   will be NULL.  */
fa3bfd
-	if (l->l_info[DT_PLTRELSZ] == NULL)
fa3bfd
-	  {
fa3bfd
-	    errstring = N_("%s: no PLTREL found in object %s\n");
fa3bfd
-	  fatal:
fa3bfd
-	    _dl_fatal_printf (errstring,
fa3bfd
-			      rtld_progname ?: "<program name unknown>",
fa3bfd
-			      l->l_name);
fa3bfd
-	  }
fa3bfd
-
fa3bfd
 	size_t sizeofrel = l->l_info[DT_PLTREL]->d_un.d_val == DT_RELA
fa3bfd
 			   ? sizeof (ElfW(Rela))
fa3bfd
 			   : sizeof (ElfW(Rel));
fa3bfd
@@ -284,7 +276,7 @@ _dl_relocate_object (struct link_map *l,
fa3bfd
 	  {
fa3bfd
 	    errstring = N_("\
fa3bfd
 %s: out of memory to store relocation results for %s\n");
fa3bfd
-	    goto fatal;
fa3bfd
+	    _dl_fatal_printf (errstring, rtld_progname, l->l_name);
fa3bfd
 	  }
fa3bfd
       }
fa3bfd
 #endif