From David Poole <daveml@mbuf.com>:
authorDaniel Jacobowitz <drow@false.org>
Tue, 9 Nov 2004 16:44:31 +0000 (16:44 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 9 Nov 2004 16:44:31 +0000 (16:44 +0000)
* elf32-arm.c (elf32_arm_readonly_dynrelocs): New function.
(elf32_arm_size_dynamic_sections): Call it.

bfd/ChangeLog
bfd/elf32-arm.c

index 12bc0ed7760e1157ee6cc8d4a3ce8f90a6d83d80..df51f6a09cf17a3762445c09d3204d3162b4900b 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-09  Daniel Jacobowitz  <dan@debian.org>
+
+       From David Poole <daveml@mbuf.com>:
+       * elf32-arm.c (elf32_arm_readonly_dynrelocs): New function.
+       (elf32_arm_size_dynamic_sections): Call it.
+
 2004-11-09  Alan Modra  <amodra@bigpond.net.au>
 
        * Makefile.am (SOURCE_HFILES): Remove elf32-arm.h.
index 80851092109ac5b1ac10357e6d42547d95e7172b..2142b97a4ea98593b884b7598e12012d0701c80d 100644 (file)
@@ -4607,6 +4607,35 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
   return TRUE;
 }
 
+/* Find any dynamic relocs that apply to read-only sections.  */
+
+static bfd_boolean
+elf32_arm_readonly_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+{
+  struct elf32_arm_link_hash_entry *eh;
+  struct elf32_arm_relocs_copied *p;
+
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+  eh = (struct elf32_arm_link_hash_entry *) h;
+  for (p = eh->relocs_copied; p != NULL; p = p->next)
+    {
+      asection *s = p->section;
+
+      if (s != NULL && (s->flags & SEC_READONLY) != 0)
+       {
+         struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+         info->flags |= DF_TEXTREL;
+
+         /* Not an error, just cut short the traversal.  */
+         return FALSE;
+       }
+    }
+  return TRUE;
+}
+
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -4815,6 +4844,12 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
            return FALSE;
        }
 
+      /* If any dynamic relocs apply to a read-only section,
+        then we need a DT_TEXTREL entry.  */
+      if ((info->flags & DF_TEXTREL) == 0)
+       elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs,
+                               (PTR) info);
+
       if ((info->flags & DF_TEXTREL) != 0)
        {
          if (!add_dynamic_entry (DT_TEXTREL, 0))
This page took 0.042772 seconds and 4 git commands to generate.