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