From 3c38b3df0cc9a8bf6569306867022c8d1b200363 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <ian@airs.com>
Date: Fri, 12 Jan 1996 19:00:18 +0000
Subject: 	* elf32-i386.c (elf_i386_size_dynamic_sections): Don't create
 a 	DT_TEXTREL entry because of .rel.plt.  From Martin Pirker 
 <pirker@eiunix.tuwien.ac.at>.

---
 bfd/elf32-i386.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

(limited to 'bfd/elf32-i386.c')

diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 3dc2970..82f0ccd 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -363,10 +363,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
 		  size = symtab_hdr->sh_info * sizeof (bfd_vma);
 		  local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
 		  if (local_got_offsets == NULL)
-		    {
-		      bfd_set_error (bfd_error_no_memory);
-		      return false;
-		    }
+		    return false;
 		  elf_local_got_offsets (abfd) = local_got_offsets;
 		  for (i = 0; i < symtab_hdr->sh_info; i++)
 		    local_got_offsets[i] = (bfd_vma) -1;
@@ -725,14 +722,19 @@ elf_i386_size_dynamic_sections (output_bfd, info)
 	      /* Remember whether there are any reloc sections other
                  than .rel.plt.  */
 	      if (strcmp (name, ".rel.plt") != 0)
-		relocs = true;
-
-	      /* If this relocation section applies to a read only
-                 section, then we probably need a DT_TEXTREL entry.  */
-	      target = bfd_get_section_by_name (output_bfd, name + 4);
-	      if (target != NULL
-		  && (target->flags & SEC_READONLY) != 0)
-		reltext = true;
+		{
+		  relocs = true;
+
+		  /* If this relocation section applies to a read only
+		     section, then we probably need a DT_TEXTREL
+		     entry.  The entries in the .rel.plt section
+		     really apply to the .got section, which we
+		     created ourselves and so know is not readonly.  */
+		  target = bfd_get_section_by_name (output_bfd, name + 4);
+		  if (target != NULL
+		      && (target->flags & SEC_READONLY) != 0)
+		    reltext = true;
+		}
 
 	      /* We use the reloc_count field as a counter if we need
 		 to copy relocs into the output file.  */
@@ -762,10 +764,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
       /* Allocate memory for the section contents.  */
       s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
       if (s->contents == NULL && s->_raw_size != 0)
-	{
-	  bfd_set_error (bfd_error_no_memory);
-	  return false;
-	}
+	return false;
     }
 	  
   if (elf_hash_table (info)->dynamic_sections_created)
-- 
cgit v1.1